[llvm] [NVPTX] Propagate truncate to operands (PR #98666)

Artem Belevich via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 18 11:37:37 PDT 2024


================
@@ -2975,6 +2975,8 @@ class TargetLoweringBase {
     return isTruncateFree(Val.getValueType(), VT2);
   }
 
+  virtual bool shouldReduceRegisterPressure() const { return false; }
----------------
Artem-B wrote:

Implementing `IsTruncateFree` may, indeed be sufficient in this case, though it addresses only this specific issue. 

We want to be able to make similar decisions in other cases, and it's not specific to a particular instruction or type, it's a target-wide parameter. I'm not quite sure how we would parameterize that.

The register pressure issue in NVPTX is, unfortunately, both very real (it's one of the most common performance regression cliffs for the GPUs), and it's also not visible on IR or PTX level, as the compilation for the actual GPU code, and eventual register spilling, is done by ptxas, outside of LLVM. All we can do is try using less registers and limit their lifetime. I can't think of a good way to quantify it, other than the vague "use less registers, please....". I think NVPTX is somewhat unique among LLVM back-ends in that regard.

https://github.com/llvm/llvm-project/pull/98666


More information about the llvm-commits mailing list