-
Notifications
You must be signed in to change notification settings - Fork 788
[NVPTX][AMDGPU] Move annotation creation out of clang #14634
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[NVPTX][AMDGPU] Move annotation creation out of clang #14634
Conversation
This patch refactors the way we lower SYCL attributes and properties to NVVM annotations, through function attributes and metadata. It unifies the flow better with the SPIR-V paths at the same time. Previously we had: 1. Clang handling function attributes in two places: a. CodeGenFunction did generic lowering of attributes to function metadata b. NVPTXTargetCodeGenInfo did its own additional lowering of attributes to NVVM annotations 2. Kernel properties being handled in clang. NVPTXTargetCodeGenInfo lowered kernel properties, which had already been converted to function attributes, to NVVM annotations. 3. Kernel properties for HIP/CUDA *not* being turned into function metadata. Because function metadata is how the ComputeModuleRuntimeInfo library creates runtime info, this meant that target backends couldn't act on properties, as they were lost during lowering. Fundamentally, clang is not the correct place for handling SYCL kernel properties as it unnecessarily touches the front-end for what is really library code. With this patch, we now have: 1. Clang handles function attributes in one place, lowering to function metadata 2. SYCLLowerIR lowers kernel properties to the same function metadata: now working for HIP and CUDA kernels too. Because function metadata is consistently present for kernel properties, they behave as expected on HIP/CUDA targets now. 3. A new pass converts function metadata to NVVM annotations, replacing the code we've taken out of clang.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Graph test changes LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sycl/test-e2e/*
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
llvm/lib/SYCLLowerIR/CMakeLists.txt lgtm
@intel/dpcpp-cfe-reviewers, ping. |
@frasercrmck, please, resolve merge conflicts. |
Done, thanks. I haven't waited for all CI but Linux looks happy at least. |
@intel/llvm-gatekeepers this looks ready to merge, thank you. |
@frasercrmck We are seeing macos post commit failures, can you please take a look? https://github.com/intel/llvm/actions/runs/10253109905/job/28365021433
|
Whoops, sorry. See #14964 |
Thanks! |
This patch refactors the way we lower SYCL attributes and properties to NVVM annotations, through function attributes and metadata. It unifies the flow better with the SPIR-V paths at the same time. Previously we had: 1. Clang handling function attributes in two places: 1. CodeGenFunction did generic lowering of attributes to function metadata 2. NVPTXTargetCodeGenInfo did its own additional lowering of attributes to NVVM annotations 2. Kernel properties being handled in clang. NVPTXTargetCodeGenInfo lowered kernel properties, which had already been converted to function attributes, to NVVM annotations. 3. Kernel properties for HIP/CUDA *not* being turned into function metadata. Because function metadata is how the ComputeModuleRuntimeInfo library creates runtime info, this meant that target backends couldn't act on properties, as they were lost during lowering. Fundamentally, clang is not the correct place for handling SYCL kernel properties as it unnecessarily touches the front-end for what is really library code. With this patch, we now have: 1. Clang handles function attributes in one place, lowering to function metadata 2. SYCLLowerIR lowers kernel properties to the same function metadata: now working for HIP and CUDA kernels too. Because function metadata is consistently present for kernel properties, they behave as expected on HIP/CUDA targets now. 3. A new pass converts function metadata to NVVM annotations, replacing the code we've taken out of clang.
This patch refactors the way we lower SYCL attributes and properties to NVVM annotations, through function attributes and metadata. It unifies the flow better with the SPIR-V paths at the same time.
Previously we had:
Fundamentally, clang is not the correct place for handling SYCL kernel properties as it unnecessarily touches the front-end for what is really library code.
With this patch, we now have: