[PATCH] D108150: [Remarks] [AMDGPU] Emit optimization remarks for atomics generating hardware instructions
Stanislav Mekhanoshin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 16 15:40:16 PDT 2021
rampitec added inline comments.
================
Comment at: clang/test/CodeGenOpenCL/atomics-remarks-gfx90a.cl:9
+// RUN: %clang_cc1 -cl-std=CL2.0 -O0 -triple=amdgcn-amd-amdhsa -target-cpu gfx90a \
+// RUN: -Rpass=si-lower -munsafe-fp-atomics %s -S -o - 2>&1 | \
----------------
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.
================
Comment at: clang/test/CodeGenOpenCL/atomics-remarks-gfx90a.cl:13
+
+// RUN: %clang_cc1 %s -cl-std=CL2.0 -O0 -triple=amdgcn-amd-amdhsa -target-cpu gfx90a \
+// RUN: -Rpass=si-lower -S -emit-llvm -o - 2>&1 | \
----------------
This line does not have -munsafe-fp-atomics option...
================
Comment at: clang/test/CodeGenOpenCL/atomics-remarks-gfx90a.cl:60
+// GFX90A-HW-LABEL: @atomic_unsafe_hw
+// GFX90A-HW: atomicrmw fadd float addrspace(1)* %{{.*}}, float %{{.*}} syncscope("workgroup-one-as") monotonic, align 4
+// GFX90A-HW: atomicrmw fadd float addrspace(1)* %{{.*}}, float %{{.*}} syncscope("agent-one-as") monotonic, align 4
----------------
... therefor these checks must fail.
================
Comment at: llvm/lib/Target/AMDGPU/SIISelLowering.cpp:12195
+ if (!fpModeMatchesGlobalFPAtomicMode(RMW))
+ return reportUnsafeHWInst(RMW, AtomicExpansionKind::None);
----------------
This is wrong. Condition is inverted and essentially tests should fail. Make sure you can pass testing before posting a diff.
================
Comment at: llvm/test/CodeGen/AMDGPU/atomics-remarks-gfx90a.ll:108
+
+; GFX90A-HW: Hardware instruction generated for atomic fadd operation at memory scope system due to an unsafe request.
+; GFX90A-HW: Hardware instruction generated for atomic fadd operation at memory scope agent due to an unsafe request.
----------------
Does it print a function name before the diagnostics? Label checks would be useful.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D108150/new/
https://reviews.llvm.org/D108150
More information about the llvm-commits
mailing list