level-zero icon indicating copy to clipboard operation
level-zero copied to clipboard

write a tool using level0 loadable through LD_PRELOAD

Open lfmeadow opened this issue 5 years ago • 2 comments

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

lfmeadow avatar May 20 '20 18:05 lfmeadow

@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.)

eero-t avatar Nov 08 '21 16:11 eero-t

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.

jandres742 avatar Nov 08 '21 16:11 jandres742