[BYOC] Is there a way to export accelerator specific mesurements


I build a BYOC C-Codegen for an accelarator. The accelerator currently only exists as a simulator but is already included. The simulator itself has functions to measur cycles needed to perform the generated code. Since I would like to evaluate the results for a profiling, I’m looking for a way to extract this data without writing them manually into a file myself.

Is there a way that I can extract this values during the runtime by calling TVM functionality from the generated code itself?

I didn’t find anything suitable so far and really would appreciate some feedback.

Hi @MartinF, I recently stumble accross the same use case, because I have exactly the same situation with a BYOC accelerator. You will find my original question here, and also the answers I received.

1 Like

Hi @fPecc, thank you very much for pointing out your original question. I did not find it when searching for this topic. Did you already figure out a practicle way for integrating MetricCollector in your Codegen and access the tracked data? The simulator I’m using simulates the device on the CPU so I’m currently not facing the issue with RPC, so a “local” extraction of the Metric would be suitable for me as well. Just in case you already have a working example, could you share it with me?

Hi @MartinF ,

I have actually not started yet with this integration. I am planning on adding this in the near future, but sadly I dont know yet when I will have the time to check this.

@MartinF if you are using cycles as a proxy for runtime and you don’t care about the runtime of the model, you can implement a custom timer for your device that measures cycles instead of runtime. You can look here for an example of how a timer is registered for CUDA: https://github.com/apache/tvm/blob/main/src/runtime/cuda/cuda_device_api.cc#L255-L288.