This is an archive of the discontinued LLVM Phabricator instance.

[OpenMP][AMDGCN] Support OpenMP offloading for AMDGCN architecture - Part 3
ClosedPublic

Authored by saiislam on Jul 21 2020, 12:04 PM.

Details

Summary

Provides AMDGCN and NVPTX specific specialization of getGPUWarpSize,
getGPUThreadID, and getGPUNumThreads methods. Adds tests for AMDGCN
codegen for these methods in generic and simd modes. Also changes the
precondition in InitTempAlloca to be slightly more permissive. Useful for
AMDGCN OpenMP codegen where allocas are created with a cast to an
address space.

Diff Detail

Event Timeline

saiislam created this revision.Jul 21 2020, 12:04 PM
ABataev added inline comments.Jul 21 2020, 12:08 PM
clang/lib/CodeGen/CGOpenMPRuntimeAMDGCN.h
25

final

clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.h
25

final

saiislam updated this revision to Diff 279610.Jul 21 2020, 12:40 PM

Added final to specialized classes.

saiislam updated this revision to Diff 280660.Jul 24 2020, 10:43 PM

Added InitTempAlloca address space cast.

saiislam edited the summary of this revision. (Show Details)Jul 24 2020, 10:46 PM
saiislam added a reviewer: arsenm.
saiislam marked an inline comment as done.Jul 24 2020, 10:50 PM
saiislam added inline comments.
clang/lib/CodeGen/CGExpr.cpp
129

@arsenm , it wasn't possible to post D78495 and this patch separately due to their interdependence. Test "clang/test/OpenMP/amdgcn_target_init_temp_alloca.cpp" below checks for this change.

saiislam updated this revision to Diff 280810.Jul 27 2020, 1:12 AM

Generalized regex in one of the test to pass harbormaster build.

ABataev added inline comments.Jul 29 2020, 8:16 AM
clang/lib/CodeGen/CGOpenMPRuntimeAMDGCN.cpp
51

Move these comments to the header instead and remove them from the .cpp module.

clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp
43

Same, move these comments to the header.

clang/test/OpenMP/amdgcn_target_codegen.cpp
13

entry: not always exist in the LLVM IR functions, better not to check for it.

19–20

Do not rely on names for the locals, some release builds do not generate them. Use regexps instead.

clang/test/OpenMP/amdgcn_target_init_temp_alloca.cpp
15–16

same, use regexps instead of %-like names

saiislam updated this revision to Diff 281932.Jul 30 2020, 8:13 AM

Moved comments to header files. Used regexps for test cases.

ABataev added inline comments.Jul 30 2020, 8:27 AM
clang/lib/CodeGen/CGOpenMPRuntimeGPU.h
201–206

Add these notes to the specialized functions too. It is required for better doxygen docs

clang/test/OpenMP/amdgcn_target_codegen.cpp
18–20

Same, the order of these checks should be strict

35–36

It should not be CHECK-DAG, the order of these 2 instructions is defined and the second one should definitely follow the first one

clang/test/OpenMP/amdgcn_target_init_temp_alloca.cpp
12

entry: again

16–18

Do not rely on the names again. Even as part of regexps

18

Just CHECK

saiislam updated this revision to Diff 282002.Jul 30 2020, 11:30 AM

Improved comment placement. Corrected check lines. Rebased.

ABataev added inline comments.Jul 30 2020, 11:34 AM
clang/lib/CodeGen/CGOpenMPRuntimeAMDGCN.h
30–31

These 2 lines can be removed, they do not add anything useful.

clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.h
30–31

These 2 lines can be removed, they do not add anything useful.

clang/test/OpenMP/amdgcn_target_codegen.cpp
20

Remove DAG

saiislam updated this revision to Diff 282010.Jul 30 2020, 11:51 AM

Changes as requested.

This revision is now accepted and ready to land.Jul 30 2020, 11:53 AM