[PATCH] D106891: [AMDGPU] [Remarks] Emit optimization remarks for FP atomics

Stanislav Mekhanoshin via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 5 15:05:26 PDT 2021


rampitec added inline comments.


================
Comment at: clang/test/CodeGenOpenCL/fp-atomics-optremarks-gfx90a.cl:23
+
+// GFX90A-HW: A floating-point atomic instruction will generate an unsafe hardware instruction which may fail to update memory [-Rpass=si-lower]
+// GFX90A-HW-LABEL: test_atomic_add
----------------
Should check other cases too. Essentially a check per every distinct emitted remark.


================
Comment at: llvm/lib/Target/AMDGPU/SIISelLowering.cpp:12120
+                   OptimizationRemarkEmitter *ORE,
+                   OptimizationRemark OptRemark) {
+  ORE->emit([&]() { return OptRemark; });
----------------
Why OptRemark and not just StringRef? I really want to see as little churn as possible at the call site.


================
Comment at: llvm/lib/Target/AMDGPU/SIISelLowering.cpp:12173
+      if (RMW->use_empty()) {
+        if (RMW->getFunction()
+                ->getFnAttribute("amdgpu-unsafe-fp-atomics")
----------------
No need to check attribute. Everything below amdgpu-unsafe-fp-atomics check to the end of the block is unsafe. Just revert to original return and call reportAtomicExpand() for the AtomicExpansionKind::None case.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D106891/new/

https://reviews.llvm.org/D106891



More information about the cfe-commits mailing list