llvm
llvm copied to clipboard
Redesign pointer handling for openCL kernel generation
Requirement - Do not decompose types with pointers when generating openCL kernel arguments.
This PR adds logic to stop decomposing trivial types containing pointers. For every SYCL kernel argument which is a record type containing a pointer (or has a field or a base class with a pointer), we generate a new record type with all pointers in __global address space. This compiler generated type is the openCL kernel argument. In the kernel body, we initialize the local clone via memcpy.
Limitations:
- Trivial record types containing array or pointers or array of types with pointers have not been handled in this PR.
- Due to current implementation restrictions, types which are not default constructible, continue to trigger decomposition if they contain pointers.
Both limitations above will hopefully be fixed in follow-up PRs.
There's still some Clang tests to fix. I fix one test to illustrate what this PR does. Before fixing the others, I figured I should ensure memcpy is actually working as expected via a runtime test. I'll take a look at that tomorrow
PR is ready for review.
Reverted PR to Draft because arrays of type containing pointer is broken. The code to exclude such cases from this logic is incorrect. Looking into a possible solution now.
ping @intel/llvm-gatekeepers. This PR is ready for review and merge. The failing CUDA Test suite looks like an infrastructure issue.
@elizabethandrews, can you follow up on post commit issues on windows? https://github.com/intel/llvm/actions/runs/3137630364/jobs/5096023697
@elizabethandrews, can you follow up on post commit issues on windows? https://github.com/intel/llvm/actions/runs/3137630364/jobs/5096023697
Fixed here - https://github.com/intel/llvm/pull/6895