[llvm] [AMDGPU] Prefer lower total register usage in regions with spilling (PR #71882)

Valery Pykhtin via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 5 09:59:26 PST 2023


================
@@ -18,6 +18,26 @@
 using namespace llvm;
 
 #define DEBUG_TYPE "machine-scheduler"
+namespace {
+
+struct ExcessVGPRWeightParser : public cl::parser<unsigned> {
+  ExcessVGPRWeightParser(cl::Option &O) : cl::parser<unsigned>(O) {}
+
+  bool parse(cl::Option &O, StringRef ArgName, StringRef Arg, unsigned &Value) {
+    if (Arg.getAsInteger(0, Value) || Value > 2048 || Value < 0)
+      return O.error("'" + Arg + "' value must be in the range [0, 2048]!");
+
+    return false;
+  }
+};
+
+} // end anonymous namespace
+
+static cl::opt<unsigned, false, ExcessVGPRWeightParser> ExcessVGPRWeight(
+    "amdgpu-excess-vgpr-weight", cl::init(32), cl::Hidden,
----------------
vpykhtin wrote:

Is this default value equals wavesize meaning that VGPR spill is 32 times more expensive than SGPR? What about wavesize 64?

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


More information about the llvm-commits mailing list