[SYCL] Add a low_power property for reusable SYCL events to reduce the CPU time spent checking wait completion conditions - #23177
Conversation
…on_option_for_sycl_event
…on_option_for_sycl_event
There was a problem hiding this comment.
🟢 Approval recommended
The implementation and test coverage are coherent; only a minor documentation cross-reference remains.
Pull request overview
Adds a reusable-event low_power property, propagating it through SYCL and Unified Runtime to Level Zero v2 event synchronization.
Changes:
- Adds SYCL and UR low-power property/descriptor APIs.
- Maps the hint to Level Zero low-power event flags.
- Adds unit, conformance, and end-to-end coverage.
File summaries
| File | Description |
|---|---|
unified-runtime/test/conformance/exp_reusable_events/reusable_events.cpp |
Tests low-power reusable events. |
unified-runtime/source/loader/ur_print.cpp |
Adds descriptor printers. |
unified-runtime/source/loader/loader.map.in |
Exports new printers on ELF. |
unified-runtime/source/loader/loader.def.in |
Exports new printers on Windows. |
unified-runtime/source/common/stype_map_helpers.def |
Maps the new structure type. |
unified-runtime/source/adapters/level_zero/v2/event.cpp |
Reads and maps the sync descriptor. |
unified-runtime/source/adapters/level_zero/v2/event_provider.hpp |
Adds the low-power provider flag. |
unified-runtime/source/adapters/level_zero/v2/event_provider_normal.cpp |
Configures low-power pooled events. |
unified-runtime/source/adapters/level_zero/v2/event_provider_counter.cpp |
Configures low-power counter events. |
unified-runtime/source/adapters/level_zero/context.hpp |
Uses the shared sync-mode definitions. |
unified-runtime/source/adapters/level_zero/common/event_sync_modes.hpp |
Centralizes Level Zero definitions. |
unified-runtime/scripts/core/exp-reusable-events.yml |
Defines the UR extension API. |
unified-runtime/include/unified-runtime/ur_print.hpp |
Adds generated C++ printing support. |
unified-runtime/include/unified-runtime/ur_print.h |
Declares generated print APIs. |
unified-runtime/include/unified-runtime/ur_api.h |
Adds generated UR types and flags. |
sycl/unittests/Extensions/ReusableEvents.cpp |
Verifies descriptor propagation. |
sycl/test-e2e/Experimental/reusable_events/low_power_event_sync_mode.cpp |
Exercises low-power signaling end to end. |
sycl/source/reusable_events.cpp |
Stores the property on event implementations. |
sycl/source/detail/event_impl.hpp |
Adds low-power event state. |
sycl/source/detail/event_impl.cpp |
Chains the UR synchronization descriptor. |
sycl/include/sycl/ext/oneapi/experimental/reusable_events.hpp |
Exposes the new property. |
sycl/include/sycl/detail/properties/property.hpp |
Registers its property kind. |
sycl/doc/extensions/experimental/sycl_ext_oneapi_reusable_events.asciidoc |
Documents the property. |
Review details
- Files reviewed: 23/23 changed files
- Comments generated: 1
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
guangyey
left a comment
There was a problem hiding this comment.
Just a question: do we still need https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/experimental/sycl_ext_intel_event_mode.asciidoc
|
@dyniols Source Checks failed - please fix it. |
I will. What about https://github.com/intel/llvm/actions/runs/35329623794/job/105557514508?pr=23177 I don’t think that failure is related. Since the Offload adapter is failing, and I haven’t changed anything there, as far as I understand UR. |
I think with addition of low_power to reusable events extension we don't need that separate extension anymore. However I am not sure let me ask @gmlueck. |
I suppose you can ignore it - @lplewa, right? |
|
Okay, I think I fixed "Source Checks" but let's wait until CI is done ;) |
| struct low_power { | ||
| low_power(bool enable = true); (1) | ||
| }; | ||
| using low_power_key = low_power; |
There was a problem hiding this comment.
Thanks for reminding me about sycl_ext_intel_event_mode. This makes me think we should change this property to an enum like:
namespace sycl::ext::oneapi::experimental {
enum class event_mode_enum { none, low_power };
struct event_mode {
event_mode(event_mode_enum mode);
};
using event_mode_key = event_mode;
}
This will let us easily add other modes in the future that correspond to ZE_EVENT_SYNC_MODE_FLAG_SIGNAL_INTERRUPT or ZE_EVENT_SYNC_MODE_FLAG_EXTERNAL_INTERRUPT_WAIT should we find a need.
Do you have any concerns with that, @guangyey?
I agree that we can eventually deprecate / remove sycl_ext_intel_event_mode. However, let's wait for sycl_ext_oneapi_reusable_events to be fully implemented first.
There was a problem hiding this comment.
I have no strong preference. For PyTorch, lower_power should be sufficient.
There was a problem hiding this comment.
If you have no strong preference, let's go with the event_mode and enumeration.
There was a problem hiding this comment.
event_mode_enum::none means regular wait, right? So, we could write code like this:
sycl::event createEvent(bool timing, bool low_power) {
return syclex::make_event(context, syclex::properties{
syclex::enable_profiling{enable_timing_},
syclex::event_mode{low_power ? event_mode_enum::low_power : event_mode_enum::none},
});
}There was a problem hiding this comment.
Ok, I will change it to the event_mode and enumeration.
There was a problem hiding this comment.
Thanks. It's a good design for our use.
|
Moving to draft since I need re-work the changes to apply #23177 (comment) |
This PR adds the feature requested in: CMPLRLLVM-77704