Skip to content

[SYCL] Add a low_power property for reusable SYCL events to reduce the CPU time spent checking wait completion conditions - #23177

Draft
dyniols wants to merge 8 commits into
intel:syclfrom
dyniols:blocking_synchronization_option_for_sycl_event
Draft

dyniols wants to merge 8 commits into
intel:syclfrom
dyniols:blocking_synchronization_option_for_sycl_event

Conversation

@dyniols

@dyniols dyniols commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

This PR adds the feature requested in: CMPLRLLVM-77704

@dyniols
dyniols requested a balanced review from Copilot September 18, 2026 09:21
@dyniols
dyniols marked this pull request as ready for review September 18, 2026 09:21
@dyniols
dyniols requested review from a team as code owners September 18, 2026 09:21
@dyniols
dyniols requested a review from slawekptak September 18, 2026 09:21

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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 guangyey left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ldorau

ldorau commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

@dyniols Source Checks failed - please fix it.

@dyniols

dyniols commented Sep 18, 2026

Copy link
Copy Markdown
Contributor Author

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

@dyniols

dyniols commented Sep 18, 2026

Copy link
Copy Markdown
Contributor Author

Just a question: do we still need https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/experimental/sycl_ext_intel_event_mode.asciidoc

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.

@ldorau

ldorau commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

@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 the failures are related to Offload adapter since I haven't changed anything there as far I understand UR.

I suppose you can ignore it - @lplewa, right?

@dyniols

dyniols commented Sep 18, 2026

Copy link
Copy Markdown
Contributor Author

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;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no strong preference. For PyTorch, lower_power should be sufficient.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you have no strong preference, let's go with the event_mode and enumeration.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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},
    });
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I will change it to the event_mode and enumeration.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. It's a good design for our use.

@dyniols
dyniols marked this pull request as draft September 18, 2026 21:15
@dyniols

dyniols commented Sep 18, 2026

Copy link
Copy Markdown
Contributor Author

Moving to draft since I need re-work the changes to apply #23177 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants