oneapi-src / level-zero

oneAPI Level Zero Specification Headers and Loader
https://spec.oneapi.com/versions/latest/elements/l0/source/index.html
MIT License
218 stars 96 forks source link

write a tool using level0 loadable through LD_PRELOAD #22

Open lfmeadow opened 4 years ago

lfmeadow commented 4 years ago

I tried to write a simple tool that I can load with LD_PRELOAD (in the spirit of MPI tools for example, or OpenCL interposers). It seems to initialize OK but it doesn't get called. One problem is that I can't get to the device handles that the runtime initializes, however the level0 spec seems to imply that I should be able to open the device again. Code attached. Is this hopeless? Seems like there should be a way to have third-party tools invoked.

tool.cpp.txt

eero-t commented 3 years ago

@lfmeadow there has been quite a bit progress in level-zero since you filed this. Did you ever got it working?

(I'm not involved with L0 development, just wondering.)

jandres742 commented 3 years ago

thanks @eero-t .

@lfmeadow please check. You can also see the ze_tracer implementation here https://github.com/intel/pti-gpu/tree/master/tools/ze_tracer for reference implementation and also tracing tests here, https://github.com/oneapi-src/level-zero-tests/tree/master/layer_tests/tracing which look similar to your reproducer.