[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 11:47:02 PDT 2021


rampitec added inline comments.


================
Comment at: llvm/lib/Target/AMDGPU/SIISelLowering.cpp:12155
+          OptimizationRemark Remark(DEBUG_TYPE, "Passed", RMW->getFunction());
+          Remark << "A floating-point atomic instruction with no following use"
+                    " will generate an unsafe hardware instruction";
----------------
I do not understand this message about the use. We are checking the use below simply because there was no return version of global_atomic_add_f32 on gfx908, so we are forced to expand it.


================
Comment at: llvm/lib/Target/AMDGPU/SIISelLowering.cpp:12165
 
-      return RMW->use_empty() ? AtomicExpansionKind::None
-                              : AtomicExpansionKind::CmpXChg;
+      if (RMW->use_empty()) {
+        if (RMW->getFunction()
----------------
That's a lot of churn. Please create a function returning AtomicExpansionKind, pass what you are going to return into that function, return that argument from the function, and also pass a string for diagnosticts to emit from there. Replace returns here with its calls. Like:

`return reportAtomicExpand(AtomicExpansionKind::None, ORE, "Produced HW atomic is unsafe and might not update memory");`


================
Comment at: llvm/lib/Target/AMDGPU/SIISelLowering.cpp:12198
+          Remark
+              << "A floating-point atomic instruction will generate an unsafe"
+                 " hardware instruction";
----------------
This one might be unsafe not because of the cache it works on, but because it might not follow denorm mode.


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