- Basically, following the support in function inline, add the scoped alias metadata support in the kernel argument lowering pass.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Unit Tests
Event Timeline
Needs some IR tests showing the metadata.
Is this the state of the art for scoped AA? I thought scoped restrict was going to involve new intrinsics (which we could also insert up front if we were consistently using byref to begin with)
llvm/lib/Target/AMDGPU/AMDGPULowerKernelArguments.cpp | ||
---|---|---|
148 | Do you really need to go through all the instruction types? I think there's a utility function for this somewhere | |
159 | I think this can be a bit smarter with intrinsics (ideally the helper would handle this too) . We already have to report which of the arguments are pointers | |
162 | Should check the callsite in case it's marked readnone, not the call itself |
Do not duplicate the logic from the inliner here, but refactor and reuse the AddNoAliasScopeMetadata from InlineFunction.cpp. That must allow the functionality to stay in sync with each other. It should also make it easier in preparation for the full restrict changes.
llvm/test/CodeGen/AMDGPU/lower-kernargs.ll | ||
---|---|---|
1262–1263 | I am also wondering why those two stores are referring to the same noalias set ? In the current noalias scope handling, I would expect something like: ; HSA-NEXT: store volatile i8 addrspace(1)* [[PTR0_LOAD]], i8 addrspace(1)* addrspace(1)* undef, align 8, !alias.scope !42, !noalias !43 ; HSA-NEXT: store volatile i8 addrspace(1)* [[PTR1_LOAD]], i8 addrspace(1)* addrspace(1)* undef, align 8, !alias.scope !43, !noalias !42 indicating that the two stores are exclusive ? | |
1937 | Also add the HSA/MESA checks for the noalias-scope related metadata. |
I am also wondering if things would become easier if the pass was restructured to create a wrapper function that contains the replacement of the arguments, and then depending on llvm::InlineFunction (the call, not the inliner pass) for the propagation of those values to the actual kernel ? That should handle the noalias attribute, as well maybe as other attributes in a clean way ?
clang-tidy: warning: #includes are not sorted properly [llvm-include-order]
not useful
clang-format: please reformat the code