Repository navigation
Conversation
c700f9b to
5051a60
Compare
5051a60 to
c4ccce7
Compare
Level Zero loader ABI checklast-release ( master ( If an ABI change is intended, a reviewer with write access can accept it: leave an approval review on the PR head commit with the keyword |
Signed-off-by: Russell McGuire <russell.w.mcguire@intel.com>
Signed-off-by: Russell McGuire <russell.w.mcguire@intel.com>
c4ccce7 to
14a392a
Compare
Add tests for zelTracerSetResultReturnValue on a runtime API returning ze_result_t, an extension API in the DDI table, and per-thread isolation of the override slot. Document and test that driver extension function epilogues cannot override the return value: the driver owns it and passes it by value, so the call returns ZE_RESULT_ERROR_INVALID_ARGUMENT. This may be supported in the future. Signed-off-by: Russell McGuire <russell.w.mcguire@intel.com>
Signed-off-by: Russell McGuire <russell.w.mcguire@intel.com>
Signed-off-by: Russell McGuire <russell.w.mcguire@intel.com>
There was a problem hiding this comment.
🟡 Changes recommended
The documentation incorrectly describes epilogue ordering as registration order rather than enablement order, which can change which override wins after a tracer is disabled and re-enabled.
1 open issue
What changed in this PR
Adds zelTracerSetResultReturnValue so tracing epilogues can override API results, supporting progress hooks without changing API parameter structures.
Changes:
- Implements thread-local result overrides and static-loader forwarding.
- Documents usage, compatibility, limitations, and error-masking risks.
- Adds tests for overrides, callback ordering, rejected calls, and thread isolation.
| File | Description |
|---|---|
| test/loader_tracing_layer.cpp | Tests result overrides and isolation. |
| test/loader_ext_fn_callback.cpp | Tests rejection in driver-extension callbacks. |
| test/CMakeLists.txt | Registers override tests. |
| source/lib/zel_tracing_libapi.cpp | Forwards calls with compatibility checks. |
| source/layers/tracing/ze_tracing.cpp | Implements the override entry point. |
| source/layers/tracing/tracing_imp.h | Exposes results during epilogues. |
| source/layers/tracing/tracing_imp.cpp | Defines thread-local result storage. |
| source/layers/tracing/README.md | Documents usage and safety considerations. |
| include/layers/zel_tracing_api.h | Declares and documents the public API. |
Review effort: Balanced
|
IMPI device-initiated RMA is now working again based on this PR (I tested again this morning on the rebased version)- thanks for your work on this! |
Epilogues run in the order tracers were enabled, not registered. Disabling and re-enabling a tracer moves it to the end, which changes which override wins. Fix the header and README, and add a test. Signed-off-by: Russell McGuire <russell.w.mcguire@intel.com>

So this adds zelTracerSetResultReturnValue(ze_result_t), which lets an epilogue
callback replace the value a traced API returns to the application. The main use
is a progress hook, i.e. an epilogue on zeEventHostSynchronize that drives
progress while the result is ZE_RESULT_NOT_READY, then reports the final result.
The requestors have tested this and confirmed it works for them.
How it works..
Epilogues run in registration order, each one sees the previous override,
last write wins.
returns ZE_RESULT_ERROR_INVALID_ARGUMENT and changes nothing.
ZE_RESULT_ERROR_UNSUPPORTED_FEATURE.
zelLoaderGetVersions.
Not supported (documented in the README)
supported in the future.
On logging, I decided not to log overrides. A log without the API name is not
much use, and with the API name it costs a store on every traced call. Instead
the README has a warning section on how an override can hide real errors, and
how to debug with it disabled.
Tests cover core, runtime and extension APIs, static and dynamic tracing,
multiple tracers, thread isolation, and the rejected cases.