Skip to content

[SYCL] Implement sycl_ext_intel_maximum_registers - #22923

Open
sarnex wants to merge 2 commits into
intel:syclfrom
sarnex:maxregimpl
Open

[SYCL] Implement sycl_ext_intel_maximum_registers#22923
sarnex wants to merge 2 commits into
intel:syclfrom
sarnex:maxregimpl

Conversation

@sarnex

@sarnex sarnex commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

This PR implements sycl_ext_intel_maximum_registers which allows per-kernel GRF size specification, communicated to the graphics driver using the SPV_INTEL_maximum_registers SPIR-V extension.

The SYCL extension defines two new properties, maximum_registers<N> and maximum_registers_automatic.

There is a similar extension sycl_ext_intel_grf_size, however the mechanism by which that extension communicates the user specification to the graphics driver is not supported in some use cases, does not use a first-class SPIR-V extension.

The new extension covers all use cases, but it requires a graphics driver supporting SPV_INTEL_maximum_registers and using it will error on drivers that do not support the new extension, so we introduced a new extension to not break existing users of sycl_ext_intel_grf_size and allow users to opt-in to the requirement to have a driver supporting this extension.

The property ends up after CFE codegen as the IR attribute sycl-maximum-registers which CompileTimePropertiesPass processes by adding the MaximumRegisters metadata to the kernel, which the SPIR-V translator is looking for.

SPIR-V translator support was implemented in KhronosGroup/SPIRV-LLVM-Translator@ca3769b.

There is no public driver implementing SPV_INTEL_maximum_registers yet, so I wrote a compile-time test to verify the property mutual exclusivity/supported register sizes, and a currently-build-only E2E test to make sure all cases at least compile. Once a driver is available and we are using it in CI, the test will XPASS so we can enable it.

I manually tested this on Linux BMG using a prototype graphics driver and everything worked as expected. I will test on Windows when a final implementation is merged, the prototype didn't support Windows.

@sarnex
sarnex force-pushed the maxregimpl branch 3 times, most recently from 84351e9 to ff83b1d Compare August 11, 2026 20:35
",+SPV_INTEL_fp_max_error"
",+SPV_INTEL_memory_access_aliasing";
",+SPV_INTEL_memory_access_aliasing"
",+SPV_INTEL_maximum_registers";

@sarnex sarnex Aug 11, 2026

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.

This will not cause an issue for older graphics drivers. The only way to generate a SPIR-V module that actually uses this extension is to use the new SYCL property implemented in this PR.

Signed-off-by: Nick Sarnie <nick.sarnie@intel.com>

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@sarnex
sarnex marked this pull request as ready for review August 11, 2026 21:33
@sarnex
sarnex requested review from a team as code owners August 11, 2026 21:33
@sarnex
sarnex requested a review from sergey-semenov August 11, 2026 21:33

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

llvm/lib/SYCLLowerIR/CompileTimePropertiesPass.cpp and sycl/doc/extensions/experimental/sycl_ext_intel_maximum_registers.asciidoc LGTM

",+SPV_INTEL_fp_max_error"
",+SPV_INTEL_memory_access_aliasing";
",+SPV_INTEL_memory_access_aliasing"
",+SPV_INTEL_maximum_registers";

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.

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.

ah good catch, i incorrectly assumed the driver one was used for both. fixed in b403905, thanks

Signed-off-by: Nick Sarnie <nick.sarnie@intel.com>
@sarnex sarnex added the new-offload-model Enables testing with NewOffloadModel. label Aug 12, 2026
@sarnex
sarnex requested review from againull and mdtoguchi August 12, 2026 15:25
@sarnex

sarnex commented Aug 13, 2026

Copy link
Copy Markdown
Contributor Author

Ping on this one @mdtoguchi @intel/llvm-reviewers-runtime, we are trying to get this into the 2026.2 release so we need to cherry pick it soon. Thank you!

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

Labels

new-offload-model Enables testing with NewOffloadModel.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants