Replace the OpenMP Runtime Library functions used in CGOpenMPRuntimeGPU for OpenMP device code generation with ones in OMPKinds.def and use OMPIRBuilder for generating runtime calls. This allows us to consolidate more OpenMP code generation into the OMPIRBuilder.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
This currently fails some Clang tests because of an error with how size_t is handled by Clang versus OMPKinds.def. The compiler will crash when generating code for a 32 bit device on a 64 bit host because Clang uses the size_t from the host while OMPKinds.def uses the size_t from the device.
clang/lib/CodeGen/CGOpenMPRuntimeGPU.h | ||
---|---|---|
38 ↗ | (On Diff #294744) | There's already an instance of OpenMPIRBuilder in CGOpenMPRuntime. Maybe just make it protected? |
clang/lib/CodeGen/CGOpenMPRuntimeGPU.h | ||
---|---|---|
38 ↗ | (On Diff #294744) | When it's generating __kmpc_shuffle_intxx around line 2480 it gets an instance of CGOpenMPRuntimeGPU indirectly which meant I had to make it public so it could use it. I could probably rewrite all the functions to be inside the class but I'm not sure if that'll break anything. So I just made it public for now. |
clang/lib/CodeGen/CGOpenMPRuntimeGPU.h | ||
---|---|---|
38 ↗ | (On Diff #294744) | I think that shouldn't be a problem. There is getOMPBuilder() in CGOpenMPRuntime. |
Reusing OMPBuilder from CGOpenMPRuntime. Altered the failing test case. This case failed when compiling for a 32 bit device on a 64 bit host. This case should be considered an error because the host and device have incompatible pointer sizes and shouldn't be able to communicate. The test has been changed to only compile for hosts and devices that have compatible pointer sizes.
Removed now unused function for generating convergent runtime functions. Updated Clang to print an error message if the user attempts to specify incompatible architectures due to a difference in pointer sizes.
Adding test cases for incompatible architecture messages. Checking the architecture is done by checking all combinations of architectures.
LGTM, that should mean OpenMPKinds lists all OpenMP runtime functions clang generates, which is great.