#1190

[RFC] Add a reference OpenCL layer implementation

Draftmartymichalwants to merge intofrom

This is an RFC where I'd like to learn whether there's an interest in a Tracy-owned implementation of a OpenCL layer (https://github.com/KhronosGroup/OpenCL-ICD-Loader#about-layers) allowing to wrap around OpenCL calls to provide tracing functionality without direct modifications of application code.

This is an early PoC that works in my limited personal testing. Some considerations for further development would be

  • which functions to wrap around (probably all relevant for Buffer, Image and Memory objects, and for Pipes and SVM), I went ahead and implemented the Buffer and Memory objects APIs. The others are yet to be implemented.
  • how many possible contexts to keep track of (currently hardcoded to 32 without proper checking of bounds),
  • how much extra detail to include for the individual objects (e.g., global/local workgroup size for kernel launches), and
  • whether keeping track of statistics makes sense.

Name, location, build system, name conventions are all up for discussion.

To test this, one needs to compile and launch their profiled application together with

  • OPENCL_LAYERS pointed to the compiled shared object (tracy-opencl-layer.so) or
  • OPENCL_LAYER_PATH pointed at a directory where to scan for the shared object.

If the layer is loaded correctly, you should see a message at the top of the message log and the supported OpenCL functions should show up in Tracy.

Activity

1

This pull request is a draft

Merging is unavailable until it is marked ready for review.