Skip to content

Conversation

@bader
Copy link
Contributor

@bader bader commented Mar 28, 2025

kernel_arg_addr_space, kernel_arg_access_qual, kernel_arg_type, kernel_arg_base_type and kernel_arg_type_qual metadata are designed to provide information about kernel arguments to clGetKernelInfo function.
SYCL does not provide similar information through API.

tahonermann added a commit to tahonermann/llvm-project that referenced this pull request Mar 28, 2025
…rnels.

Elizabeth's changes to perform code generation for SYCL kernel device entry
point functions caused the following kernel metadata annotations to be
emitted for all device targets.
- `kernel_arg_addr_space`
- `kernel_arg_access_qual`
- `kernel_arg_type`
- `kernel_arg_base_type`
- `kernel_arg_type_qual`

It turns out that such metadata is not needed for SYCL; the above annotations
are only needed for OpenCL. Investigation revealed that these annotations are
emitted by the oneAPI compiler for ESIMD functions, but that was apparently
due to an incorrect merge conflict resolution that is now being addressed by
intel/llvm#17723.

The above annotations are referenced by the SPIR-V Translator documentation.
See https://github.com/KhronosGroup/SPIRV-LLVM-Translator/blob/main/docs/SPIRVRepresentationInLLVM.rst#function-metadata.

The oneAPI compiler does emit a `kernel_arg_buffer_location` annotation that
is presumed to be needed as part of the support for the dead kernel argument
elimination pass. Support for that annotation does not yet exist upstream.
@bader bader marked this pull request as ready for review March 28, 2025 22:55
@bader bader requested review from a team as code owners March 28, 2025 22:55

// CHECK: define dso_local spir_kernel {{.*}} !kernel_arg_addr_space ![[#MD:]]
// CHECK: !kernel_arg_access_qual ![[#MD]] !kernel_arg_type ![[#MD]] !kernel_arg_base_type ![[#MD]] !kernel_arg_type_qual ![[#MD]] !kernel_arg_accessor_ptr ![[#MD]]
// CHECK: define dso_local spir_kernel {{.*}} !sycl_kernel_omit_args ![[#MD:]]
Copy link
Contributor Author

@bader bader Mar 28, 2025

Choose a reason for hiding this comment

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

@intel/dpcpp-esimd-reviewers, I'm sure I understand the purpose of this test, but I tried to check that "dead argument elimination" optimization attaches metadata correctly.
It looks like original test verifies that other metadata do not refer to deleted argument. Should I check for !kernel_arg_accessor_ptr?
I removed it because "dead argument elimination" should not change the value of this metadata. It will be empty in any case.

Copy link
Contributor

Choose a reason for hiding this comment

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

your change looks fine thx

@bader bader temporarily deployed to WindowsCILock March 28, 2025 23:13 — with GitHub Actions Inactive
@bader bader temporarily deployed to WindowsCILock March 28, 2025 23:13 — with GitHub Actions Inactive
@bader
Copy link
Contributor Author

bader commented Mar 28, 2025

CI results analysis:

SYCL Pre Commit on Windows / build / Build + LIT (pull_request)
Test environment issue.

Jenkins/Precommit
CI system failed to find the runner.

@bader
Copy link
Contributor Author

bader commented Mar 31, 2025

@intel/dpcpp-cfe-reviewers, ping.

@bader bader merged commit fad7dbb into intel:sycl Mar 31, 2025
21 of 23 checks passed
@bader bader deleted the kernel-metadata branch March 31, 2025 22:06
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.

3 participants