- produce remarks when atomic instructions are expanded into hardware instructions in SIISelLowering.cpp
- an OpenCL test containing both IR-level and ISA level checks
- currently only support for atomic fadd
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
- Add [AMDGPU] to the title.
- Rebase on top of D106891.
- Add tests to atomics-remarks-gfx90a.ll as well, including LDS with matching and non-matching rounding mode.
llvm/lib/Target/AMDGPU/SIISelLowering.cpp | ||
---|---|---|
12194 | This is safe. | |
12200 | This is safe if fpModeMatchesGlobalFPAtomicMode(RMW) returned true and unsafe if not. |
clang/test/CodeGenOpenCL/atomics-remarks-gfx90a.cl | ||
---|---|---|
9 | You are compiling 2 functions with 2 different sets of options. Essentially it is unclear what are you checking because either half skips half of the remarks. Either compile a single function differently or make 2 different tests. | |
13 | This line does not have -munsafe-fp-atomics option... | |
60 | ... therefor these checks must fail. | |
llvm/lib/Target/AMDGPU/SIISelLowering.cpp | ||
12196 | This is wrong. Condition is inverted and essentially tests should fail. Make sure you can pass testing before posting a diff. | |
llvm/test/CodeGen/AMDGPU/atomics-remarks-gfx90a.ll | ||
108 ↗ | (On Diff #366752) | Does it print a function name before the diagnostics? Label checks would be useful. |
- split the OpenCL test into two for brevity
- fixed a mistake in SIISelLowering as pointed out by reviewer
- added the missing -munsafe-fp-atomics flag
clang/test/CodeGenOpenCL/atomics-remarks-gfx90a.cl | ||
---|---|---|
9 | You do not need to change this file anymore. | |
llvm/lib/Target/AMDGPU/SIISelLowering.cpp | ||
12122 | It does not need to me a method, just a static function or better even lamdba. | |
12196 | Unresolved. | |
llvm/test/CodeGen/AMDGPU/atomics-remarks-gfx90a.ll | ||
108 ↗ | (On Diff #366752) | That's pity. Then this file need to be split too. |
llvm/lib/Target/AMDGPU/SIISelLowering.cpp | ||
---|---|---|
12196 | Remarks are produced if fpModeMatchesGlobalFPAtomicMode(RMW) == false |
llvm/lib/Target/AMDGPU/SIISelLowering.cpp | ||
---|---|---|
12196 | But you have changed what function was doing. It was returning CmpXChg. |
- corrected AtomicExpansionKind return value in SIISelLowering as pointed out by reviewer
- eliminated previous function declaration which is not defined/used anymore
My understanding is that since we are reporting unsafe expansion into hw instructions, fpModeMatchesGlobalFPAtomicMode(RMW) must be false to match the logic.
llvm/lib/Target/AMDGPU/SIISelLowering.cpp | ||
---|---|---|
12201 | if (fpModeMatchesGlobalFPAtomicMode(RMW)) return AtomicExpansionKind::None; return RMW->getFunction() ->getFnAttribute("amdgpu-unsafe-fp-atomics") .getValueAsString() == "true" ? ReportUnsafeHWInst(AtomicExpansionKind::None) : AtomicExpansionKind::CmpXChg; |
You are compiling 2 functions with 2 different sets of options. Essentially it is unclear what are you checking because either half skips half of the remarks. Either compile a single function differently or make 2 different tests.