Repository navigation
Count a LocalAccessor as up to 4 arguments in the kernel argument count check - #2425
Open
ndgrigorian wants to merge 2 commits into
Open
ndgrigorian wants to merge 2 commits into
ndgrigorian wants to merge 2 commits into
Conversation
ndgrigorian
requested review from
antonwolfy and
vlad-perevezentsev
as code owners
November 8, 2026 20:51
ndgrigorian
force-pushed
the
fix-kernel-arg-count-check
branch
from
November 8, 2026 20:51
c562604 to
b7f435b
Compare
|
View rendered docs @ https://intelpython.github.io/dpctl/pulls/2425/index.html |
Collaborator
DPCTLKernel_GetNumArgs returns -1 when the query throws, and SyclKernel.get_num_args raises RuntimeError
a sycl::local_accessor is 4 arguments in a kernel compiled from SYCL source, so the argument count check rejected such kernels; the LocalAccessor docstring now describes passing a split local accessor to SPIR-V from SYCL
ndgrigorian
force-pushed
the
fix-kernel-arg-count-check
branch
from
December 3, 2026 07:31
40dcdf2 to
83c01c8
Compare
5 of 8 tasks
vlad-perevezentsev
approved these changes
Dec 3, 2026
vlad-perevezentsev
left a comment
Collaborator
There was a problem hiding this comment.
LGTM
I checked 83c01c8 on Battlemage GPUs (Level Zero and OpenCL), an iGPU without fp64 and the OpenCL CPU: all three points are fixed, and dpnp built without this PR passes its test suite with it, with no warnings on import.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes the check on the number of kernel arguments added to
SyclQueue.submitandSyclQueue.submit_asyncin gh-2382. It compares the number of arguments given withinfo::kernel::num_args, which for a kernel compiled from SYCL source is the number of arguments of the backend kernel, in which asycl::local_accessoris 4 arguments, so such a kernel can not be submitted with adpctl.LocalAccessor:A
dpctl.LocalAccessoris now counted as 1 to 4 arguments: the check raisesValueErrorif more arguments are given than the kernel takes, or if fewer are given with eachdpctl.LocalAccessorcounted as 4. Without adpctl.LocalAccessor, the check is exact as before. Every other argument type, includingdpctl.WorkGroupMemoryanddpctl.RawKernelArg, is 1 argument in every kind of kernel. This was measured with DPC++ 2026.2 on OpenCL CPU, OpenCL GPU and Level Zero GPU, for kernels from OpenCL C source, SPIR-V and SYCL source. Thedpctl.LocalAccessorarguments are counted in a C loop over the argument types already collected for submissionA kernel compiled from SYCL to SPIR-V expects a
sycl::local_accessorparameter as 4 arguments: the local memory pointer, followed by the access range, memory range and offset, each of which is one argument of Nsize_tfor an N-dimensional accessor. Thedpctl.LocalAccessordocstring now shows how to pass themDPCTLKernel_GetNumArgsalso no longer aborts the process when the query throws, returning -1, andSyclKernel.get_num_argsraisesRuntimeErrorin that case. The arguments of a kernel whose number of arguments can not be queried are not checked