Skip to content

Add support for specialization constants#2304

Open
ndgrigorian wants to merge 7 commits intorename-sycl-program-sycl-kernel-bundlefrom
feature/specialization-constants
Open

Add support for specialization constants#2304
ndgrigorian wants to merge 7 commits intorename-sycl-program-sycl-kernel-bundlefrom
feature/specialization-constants

Conversation

@ndgrigorian
Copy link
Copy Markdown
Collaborator

@ndgrigorian ndgrigorian commented Apr 28, 2026

This PR introduces support for specialization constants in dpctl, including both a Cython class SpecializationConstant for construction and passing of the constructed class to create_kernel_bundle_from_spirv via a new specializations keyword argument.

The SpecializationConstant class supports multiple constructors, including from Python buffers, a dtype string and a Python buffer (casting to the dtype via NumPy), and a number of bytes and a pointer as integers.

Also introduces dpctl.program.utils with parse_spirv_specializations utility function, allowing the user to query a SPIR-V directly from Python.

  • Have you provided a meaningful PR description?
  • Have you added a test, reproducer or referred to an issue with a reproducer?
  • Have you tested your changes locally for CPU and GPU devices?
  • Have you made sure that new changes do not introduce compiler warnings?
  • Have you checked performance impact of proposed changes?
  • Have you added documentation for your changes, if necessary?
  • Have you added your changes to the changelog?
  • If this PR is a work in progress, are you opening the PR as a draft?

@ndgrigorian ndgrigorian changed the title Feature/specialization constants Add support for specialization constants Apr 28, 2026
@github-actions
Copy link
Copy Markdown

@coveralls
Copy link
Copy Markdown
Collaborator

coveralls commented Apr 28, 2026

Coverage Status

Coverage is 75.295%feature/specialization-constants into rename-sycl-program-sycl-kernel-bundle. No base build found for rename-sycl-program-sycl-kernel-bundle.

also removes "v" as a permitted specialization constant intermediate data type, as composite specialization constants are broken into multiple specialization constants, so structs end up passed as a single constant while the program expects multiple, and therefore, doesn't work as intended
@ndgrigorian ndgrigorian force-pushed the feature/specialization-constants branch 3 times, most recently from b7f8d82 to 8c5651d Compare May 5, 2026 06:23
@ndgrigorian ndgrigorian marked this pull request as ready for review May 5, 2026 06:28
@ndgrigorian ndgrigorian force-pushed the feature/specialization-constants branch 2 times, most recently from 961be21 to 8dbb320 Compare May 5, 2026 06:49
also adds spec_id, itemsize, and default_value fields
@ndgrigorian ndgrigorian force-pushed the feature/specialization-constants branch from 8dbb320 to 043aa83 Compare May 5, 2026 06:52
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.

2 participants