Skip to content

[Exegesis][RISCV] Add initial RVV support #128767

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Feb 28, 2025

Conversation

mshockwave
Copy link
Member

This patch adds initial vector extension support to RISC-V's exegesis. The strategy here is to enumerate all RVV pseudo opcodes as their MC opcode counterparts are kind of useless under this circumstance. We also enumerate all possible VTYPE operands in each CodeTemplate configuration. Various of MachineFunction Passes are used for post processing the snippets, like inserting VSETVLI instructions.

See https://llvm.org/devmtg/2024-10/slides/techtalk/Hsu-RVV-Exegesis.pdf for more technical details.


Note that I didn't bring all RVV snippet generator features from #114149 (I did address related review comments from there though), for example the newly added ExegesisTarget::assignInitialRegisterValue callback. Because they're slightly orthogonal and I'm planning to add them in separate patches.

I also made some changes outside the RVV snippet generator -- adding exegesis::Operand::isEarlyClobber and printer for VXRM rounding modes in RISCVBaseInfo.h. I didn't split them into a separate patch because they're relatively hard to test in standalone patches. Plus, RVV snippet generator is the only user.

@llvmbot
Copy link
Member

llvmbot commented Feb 25, 2025

@llvm/pr-subscribers-backend-risc-v

@llvm/pr-subscribers-tools-llvm-exegesis

Author: Min-Yih Hsu (mshockwave)

Changes

This patch adds initial vector extension support to RISC-V's exegesis. The strategy here is to enumerate all RVV pseudo opcodes as their MC opcode counterparts are kind of useless under this circumstance. We also enumerate all possible VTYPE operands in each CodeTemplate configuration. Various of MachineFunction Passes are used for post processing the snippets, like inserting VSETVLI instructions.

See https://llvm.org/devmtg/2024-10/slides/techtalk/Hsu-RVV-Exegesis.pdf for more technical details.


Note that I didn't bring all RVV snippet generator features from #114149 (I did address related review comments from there though), for example the newly added ExegesisTarget::assignInitialRegisterValue callback. Because they're slightly orthogonal and I'm planning to add them in separate patches.

I also made some changes outside the RVV snippet generator -- adding exegesis::Operand::isEarlyClobber and printer for VXRM rounding modes in RISCVBaseInfo.h. I didn't split them into a separate patch because they're relatively hard to test in standalone patches. Plus, RVV snippet generator is the only user.


Patch is 55.64 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/128767.diff

22 Files Affected:

  • (modified) llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h (+37)
  • (added) llvm/test/tools/llvm-exegesis/RISCV/rvv/eligible-inst.test (+10)
  • (added) llvm/test/tools/llvm-exegesis/RISCV/rvv/explicit-sew.test (+7)
  • (added) llvm/test/tools/llvm-exegesis/RISCV/rvv/filter.test (+6)
  • (added) llvm/test/tools/llvm-exegesis/RISCV/rvv/reduction.test (+7)
  • (added) llvm/test/tools/llvm-exegesis/RISCV/rvv/self-aliasing.test (+6)
  • (added) llvm/test/tools/llvm-exegesis/RISCV/rvv/skip-rm.test (+12)
  • (added) llvm/test/tools/llvm-exegesis/RISCV/rvv/valid-sew-zvk.test (+33)
  • (added) llvm/test/tools/llvm-exegesis/RISCV/rvv/valid-sew.test (+41)
  • (added) llvm/test/tools/llvm-exegesis/RISCV/rvv/vlmax-only.test (+7)
  • (added) llvm/test/tools/llvm-exegesis/RISCV/rvv/vtype-rm-setup.test (+13)
  • (modified) llvm/tools/llvm-exegesis/lib/MCInstrDescView.cpp (+4)
  • (modified) llvm/tools/llvm-exegesis/lib/MCInstrDescView.h (+4)
  • (modified) llvm/tools/llvm-exegesis/lib/RISCV/CMakeLists.txt (+2)
  • (added) llvm/tools/llvm-exegesis/lib/RISCV/RISCVExegesisPasses.h (+19)
  • (added) llvm/tools/llvm-exegesis/lib/RISCV/RISCVExegesisPostprocessing.cpp (+130)
  • (added) llvm/tools/llvm-exegesis/lib/RISCV/RISCVExegesisPreprocessing.cpp (+85)
  • (modified) llvm/tools/llvm-exegesis/lib/RISCV/Target.cpp (+649-38)
  • (modified) llvm/tools/llvm-exegesis/lib/SerialSnippetGenerator.cpp (+2)
  • (modified) llvm/tools/llvm-exegesis/lib/Target.cpp (+13)
  • (modified) llvm/tools/llvm-exegesis/lib/Target.h (+3)
  • (modified) llvm/tools/llvm-exegesis/llvm-exegesis.cpp (+2-13)
diff --git a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h
index 80ff18d914dca..135aec0c8135c 100644
--- a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h
+++ b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h
@@ -432,7 +432,44 @@ enum RoundingMode {
   RNE = 1,
   RDN = 2,
   ROD = 3,
+  Invalid
 };
+
+inline static StringRef roundingModeToString(RoundingMode RndMode) {
+  switch (RndMode) {
+  default:
+    llvm_unreachable("Unknown vector fixed-point rounding mode");
+  case RISCVVXRndMode::RNU:
+    return "rnu";
+  case RISCVVXRndMode::RNE:
+    return "rne";
+  case RISCVVXRndMode::RDN:
+    return "rdn";
+  case RISCVVXRndMode::ROD:
+    return "rod";
+  }
+}
+
+inline static RoundingMode stringToRoundingMode(StringRef Str) {
+  return StringSwitch<RoundingMode>(Str)
+      .Case("rnu", RISCVVXRndMode::RNU)
+      .Case("rne", RISCVVXRndMode::RNE)
+      .Case("rdn", RISCVVXRndMode::RDN)
+      .Case("rod", RISCVVXRndMode::ROD)
+      .Default(RISCVVXRndMode::Invalid);
+}
+
+inline static bool isValidRoundingMode(unsigned Mode) {
+  switch (Mode) {
+  default:
+    return false;
+  case RISCVVXRndMode::RNU:
+  case RISCVVXRndMode::RNE:
+  case RISCVVXRndMode::RDN:
+  case RISCVVXRndMode::ROD:
+    return true;
+  }
+}
 } // namespace RISCVVXRndMode
 
 //===----------------------------------------------------------------------===//
diff --git a/llvm/test/tools/llvm-exegesis/RISCV/rvv/eligible-inst.test b/llvm/test/tools/llvm-exegesis/RISCV/rvv/eligible-inst.test
new file mode 100644
index 0000000000000..189adf2c1b334
--- /dev/null
+++ b/llvm/test/tools/llvm-exegesis/RISCV/rvv/eligible-inst.test
@@ -0,0 +1,10 @@
+# RUN: llvm-exegesis -mtriple=riscv64 -mcpu=sifive-x280 -benchmark-phase=assemble-measured-code --mode=latency \
+# RUN:    --opcode-name=PseudoVCOMPRESS_VM_M2_E8,PseudoVCPOP_M_B32 | FileCheck %s --allow-empty --check-prefix=LATENCY
+# RUN: llvm-exegesis -mtriple=riscv64 -mcpu=sifive-x280 -benchmark-phase=assemble-measured-code --mode=inverse_throughput \
+# RUN:    --opcode-name=PseudoVCOMPRESS_VM_M2_E8,PseudoVCPOP_M_B32 --min-instructions=100 | FileCheck %s --check-prefix=RTHROUGHPUT
+
+# LATENCY-NOT: PseudoVCOMPRESS_VM_M2_E8
+# LATENCY-NOT: PseudoVCPOP_M_B32
+
+# RTHROUGHPUT: PseudoVCOMPRESS_VM_M2_E8
+# RTHROUGHPUT: PseudoVCPOP_M_B32
diff --git a/llvm/test/tools/llvm-exegesis/RISCV/rvv/explicit-sew.test b/llvm/test/tools/llvm-exegesis/RISCV/rvv/explicit-sew.test
new file mode 100644
index 0000000000000..476cf35818d6f
--- /dev/null
+++ b/llvm/test/tools/llvm-exegesis/RISCV/rvv/explicit-sew.test
@@ -0,0 +1,7 @@
+# RUN: llvm-exegesis -mtriple=riscv64 -mcpu=sifive-x280 -benchmark-phase=assemble-measured-code --mode=latency --opcode-name=PseudoVFWREDUSUM_VS_M1_E32 \
+# RUN:    --max-configs-per-opcode=1000 --min-instructions=100 | FileCheck %s
+
+# Make sure none of the config has SEW other than e32
+# CHECK: PseudoVFWREDUSUM_VS_M1_E32
+# CHECK: SEW: e32
+# CHECK-NOT: SEW: e{{(8|16|64)}}
diff --git a/llvm/test/tools/llvm-exegesis/RISCV/rvv/filter.test b/llvm/test/tools/llvm-exegesis/RISCV/rvv/filter.test
new file mode 100644
index 0000000000000..e3a4336fdf670
--- /dev/null
+++ b/llvm/test/tools/llvm-exegesis/RISCV/rvv/filter.test
@@ -0,0 +1,6 @@
+# RUN: llvm-exegesis -mtriple=riscv64 -mcpu=sifive-x280 -benchmark-phase=assemble-measured-code --mode=inverse_throughput --opcode-name=PseudoVNCLIPU_WX_M1_MASK \
+# RUN:    --riscv-filter-config='vtype = {VXRM: rod, AVL: VLMAX, SEW: e(8|16), Policy: ta/mu}' --max-configs-per-opcode=1000 --min-instructions=100 | FileCheck %s
+
+# CHECK: config:          'vtype = {VXRM: rod, AVL: VLMAX, SEW: e8, Policy: ta/mu}'
+# CHECK: config:          'vtype = {VXRM: rod, AVL: VLMAX, SEW: e16, Policy: ta/mu}'
+# CHECK-NOT: config:          'vtype = {VXRM: rod, AVL: VLMAX, SEW: e(32|64), Policy: ta/mu}'
diff --git a/llvm/test/tools/llvm-exegesis/RISCV/rvv/reduction.test b/llvm/test/tools/llvm-exegesis/RISCV/rvv/reduction.test
new file mode 100644
index 0000000000000..a637fa24af16b
--- /dev/null
+++ b/llvm/test/tools/llvm-exegesis/RISCV/rvv/reduction.test
@@ -0,0 +1,7 @@
+# RUN: llvm-exegesis -mtriple=riscv64 -mcpu=sifive-p670 -benchmark-phase=assemble-measured-code --mode=latency --opcode-name=PseudoVWREDSUMU_VS_M8_E32 --min-instructions=100 | \
+# RUN:    FileCheck %s
+
+# Make sure reduction ops don't have alias between vd and vs1
+# CHECK:      instructions:
+# CHECK-NEXT: PseudoVWREDSUMU_VS_M8_E32
+# CHECK-NOT:  V[[REG:[0-9]+]] V[[REG]] V{{[0-9]+}}M8 V[[REG]]
diff --git a/llvm/test/tools/llvm-exegesis/RISCV/rvv/self-aliasing.test b/llvm/test/tools/llvm-exegesis/RISCV/rvv/self-aliasing.test
new file mode 100644
index 0000000000000..c950341716238
--- /dev/null
+++ b/llvm/test/tools/llvm-exegesis/RISCV/rvv/self-aliasing.test
@@ -0,0 +1,6 @@
+# RUN: llvm-exegesis -mtriple=riscv64 -mcpu=sifive-x280 -benchmark-phase=assemble-measured-code --mode=latency --opcode-name=PseudoVXOR_VX_M4 --min-instructions=100 | \
+# RUN:    FileCheck %s
+
+# Make sure all def / use operands are the same in latency mode.
+# CHECK:      instructions:
+# CHECK-NEXT: PseudoVXOR_VX_M4 V[[REG:[0-9]+]]M4 V[[REG]]M4 V[[REG]]M4 X{{.*}}
diff --git a/llvm/test/tools/llvm-exegesis/RISCV/rvv/skip-rm.test b/llvm/test/tools/llvm-exegesis/RISCV/rvv/skip-rm.test
new file mode 100644
index 0000000000000..a3af37149eeb5
--- /dev/null
+++ b/llvm/test/tools/llvm-exegesis/RISCV/rvv/skip-rm.test
@@ -0,0 +1,12 @@
+# RUN: llvm-exegesis -mtriple=riscv64 -mcpu=sifive-x280 -benchmark-phase=assemble-measured-code --mode=latency --opcode-name=PseudoVAADDU_VV_M1 \
+# RUN:    --riscv-enumerate-rounding-modes=false --max-configs-per-opcode=1000 --min-instructions=100 | FileCheck %s --check-prefix=VXRM
+# RUN: llvm-exegesis -mtriple=riscv64 -mcpu=sifive-x280 -benchmark-phase=assemble-measured-code --mode=latency --opcode-name=PseudoVFADD_VFPR16_M1_E16 \
+# RUN:    --riscv-enumerate-rounding-modes=false --max-configs-per-opcode=1000 --min-instructions=100 | FileCheck %s --check-prefix=FRM
+
+# VXRM: PseudoVAADDU_VV_M1
+# VXRM: VXRM: rnu
+# VXRM-NOT: VXRM: {{(rne|rdn|rod)}}
+
+# FRM: PseudoVFADD_VFPR16_M1_E16
+# FRM: FRM: rne
+# FRM-NOT: FRM: {{(rtz|rdn|rup|rmm|dyn)}}
diff --git a/llvm/test/tools/llvm-exegesis/RISCV/rvv/valid-sew-zvk.test b/llvm/test/tools/llvm-exegesis/RISCV/rvv/valid-sew-zvk.test
new file mode 100644
index 0000000000000..515d3397b57be
--- /dev/null
+++ b/llvm/test/tools/llvm-exegesis/RISCV/rvv/valid-sew-zvk.test
@@ -0,0 +1,33 @@
+# RUN: llvm-exegesis -mtriple=riscv64 -mcpu=sifive-p670 -benchmark-phase=assemble-measured-code --mode=inverse_throughput \
+# RUN:    --opcode-name=PseudoVAESDF_VS_M1_M1 --max-configs-per-opcode=1000 --min-instructions=100 | \
+# RUN:    FileCheck %s --check-prefix=ZVK
+# RUN: llvm-exegesis -mtriple=riscv64 -mcpu=sifive-p670 -benchmark-phase=assemble-measured-code --mode=inverse_throughput \
+# RUN:    --opcode-name=PseudoVGHSH_VV_M1 --max-configs-per-opcode=1000 --min-instructions=100 | \
+# RUN:    FileCheck %s --check-prefix=ZVK
+# RUN: llvm-exegesis -mtriple=riscv64 -mcpu=sifive-p670 -benchmark-phase=assemble-measured-code --mode=inverse_throughput \
+# RUN:    --opcode-name=PseudoVSM4K_VI_M1 --max-configs-per-opcode=1000 --min-instructions=100 | \
+# RUN:    FileCheck %s --check-prefix=ZVK
+# RUN: llvm-exegesis -mtriple=riscv64 -mcpu=sifive-p670 -benchmark-phase=assemble-measured-code --mode=inverse_throughput \
+# RUN:    --opcode-name=PseudoVSM3C_VI_M2 --max-configs-per-opcode=1000 --min-instructions=100 | \
+# RUN:    FileCheck %s --check-prefix=ZVK
+# RUN: llvm-exegesis -mtriple=riscv64 -mcpu=sifive-p670 -benchmark-phase=assemble-measured-code --mode=inverse_throughput \
+# RUN:    --opcode-name=PseudoVSHA2MS_VV_M1_E32 --max-configs-per-opcode=1000 --min-instructions=100 | \
+# RUN:    FileCheck %s --allow-empty --check-prefix=ZVKNH
+# RUN: llvm-exegesis -mtriple=riscv64 -mcpu=sifive-p670 -benchmark-phase=assemble-measured-code --mode=inverse_throughput \
+# RUN:    --opcode-name=PseudoVSHA2MS_VV_M2_E64 --max-configs-per-opcode=1000 --min-instructions=100 | \
+# RUN:    FileCheck %s --allow-empty --check-prefix=ZVKNH
+# RUN: llvm-exegesis -mtriple=riscv64 -mcpu=sifive-p670 -benchmark-phase=assemble-measured-code --mode=inverse_throughput \
+# RUN:    --opcode-name=PseudoVSM3C_VI_M1 --max-configs-per-opcode=1000 --min-instructions=100 | \
+# RUN:    FileCheck %s --allow-empty --check-prefix=EMPTY
+
+# Most vector crypto only supports SEW=32, except Zvknhb which also supports SEW=64
+# ZVK-NOT: SEW: e{{(8|16)}}
+# ZVK: SEW: e32
+# ZVK-NOT: SEW: e64
+
+# ZVKNH(A|B) can either have SEW=32 (EGW=128) or SEW=64 (EGW=256)
+
+# ZVKNH-NOT: SEW: e{{(8|16)}}
+# ZVKNH: SEW: e{{(32|64)}}
+
+# EMPTY-NOT: SEW: e{{(8|16|32|64)}}
diff --git a/llvm/test/tools/llvm-exegesis/RISCV/rvv/valid-sew.test b/llvm/test/tools/llvm-exegesis/RISCV/rvv/valid-sew.test
new file mode 100644
index 0000000000000..b678300564529
--- /dev/null
+++ b/llvm/test/tools/llvm-exegesis/RISCV/rvv/valid-sew.test
@@ -0,0 +1,41 @@
+# RUN: llvm-exegesis -mtriple=riscv64 -mcpu=sifive-x280 -benchmark-phase=assemble-measured-code --mode=latency --opcode-name=PseudoVMUL_VV_MF4_MASK \
+# RUN:    --max-configs-per-opcode=1000 --min-instructions=100 | FileCheck %s --check-prefix=FRAC-LMUL
+# RUN: llvm-exegesis -mtriple=riscv64 -mcpu=sifive-x280 -benchmark-phase=assemble-measured-code --mode=latency \
+# RUN:    --opcode-name=PseudoVFADD_VFPR16_M1_E16,PseudoVFADD_VV_M2_E16,PseudoVFCLASS_V_MF2 --max-configs-per-opcode=1000 --min-instructions=100 | \
+# RUN:    FileCheck %s --check-prefix=FP
+# RUN: llvm-exegesis -mtriple=riscv64 -mcpu=sifive-x280 -benchmark-phase=assemble-measured-code --mode=inverse_throughput \
+# RUN:    --opcode-name=PseudoVSEXT_VF8_M2,PseudoVZEXT_VF8_M2 --max-configs-per-opcode=1000 --min-instructions=100 | \
+# RUN:    FileCheck %s --check-prefix=VEXT
+# RUN: llvm-exegesis -mtriple=riscv64 -mcpu=sifive-p470 -benchmark-phase=assemble-measured-code --mode=latency \
+# RUN:    --opcode-name=PseudoVFREDUSUM_VS_M1_E16 --max-configs-per-opcode=1000 --min-instructions=100 | \
+# RUN:    FileCheck %s --check-prefix=VFRED --allow-empty
+
+# Make sure only the supported SEWs are generated for fractional LMUL.
+# FRAC-LMUL: PseudoVMUL_VV_MF4_MASK
+# FRAC-LMUL: SEW: e8
+# FRAC-LMUL: SEW: e16
+# FRAC-LMUL-NOT: SEW: e{{(32|64)}}
+
+# Make sure only SEWs that are equal to the supported FLEN are generated
+# FP: PseudoVFADD_VFPR16_M1_E16
+# FP-NOT: SEW: e8
+# FP: PseudoVFADD_VV_M2_E16
+# FP-NOT: SEW: e8
+# FP: PseudoVFCLASS_V_MF2
+# FP-NOT: SEW: e8
+
+# VS/ZEXT can only operate on SEW that will not lead to invalid EEW on the
+# source operand.
+# VEXT: PseudoVSEXT_VF8_M2
+# VEXT-NOT: SEW: e8
+# VEXT-NOT: SEW: e16
+# VEXT-NOT: SEW: e32
+# VEXT: SEW: e64
+# VEXT: PseudoVZEXT_VF8_M2
+# VEXT-NOT: SEW: e8
+# VEXT-NOT: SEW: e16
+# VEXT-NOT: SEW: e32
+# VEXT: SEW: e64
+
+# P470 doesn't have Zvfh so 16-bit vfredusum shouldn't exist
+# VFRED-NOT: PseudoVFREDUSUM_VS_M1_E16
diff --git a/llvm/test/tools/llvm-exegesis/RISCV/rvv/vlmax-only.test b/llvm/test/tools/llvm-exegesis/RISCV/rvv/vlmax-only.test
new file mode 100644
index 0000000000000..30897b6e13735
--- /dev/null
+++ b/llvm/test/tools/llvm-exegesis/RISCV/rvv/vlmax-only.test
@@ -0,0 +1,7 @@
+# RUN: llvm-exegesis -mtriple=riscv64 -mcpu=sifive-x280 -benchmark-phase=assemble-measured-code --mode=latency --opcode-name=PseudoVFWREDUSUM_VS_M1_E32 \
+# RUN:    --riscv-vlmax-for-vl --max-configs-per-opcode=1000 --min-instructions=100 | FileCheck %s
+
+# Only allow VLMAX for AVL when -riscv-vlmax-for-vl is present
+# CHECK: PseudoVFWREDUSUM_VS_M1_E32
+# CHECK: AVL: VLMAX
+# CHECK-NOT: AVL: {{(simm5|<MCOperand: .*>)}}
diff --git a/llvm/test/tools/llvm-exegesis/RISCV/rvv/vtype-rm-setup.test b/llvm/test/tools/llvm-exegesis/RISCV/rvv/vtype-rm-setup.test
new file mode 100644
index 0000000000000..c41b357c13821
--- /dev/null
+++ b/llvm/test/tools/llvm-exegesis/RISCV/rvv/vtype-rm-setup.test
@@ -0,0 +1,13 @@
+# RUN: llvm-exegesis -mtriple=riscv64 -mcpu=sifive-x280 -benchmark-phase=assemble-measured-code --mode=latency --opcode-name=PseudoVFWREDUSUM_VS_M1_E32 \
+# RUN:    --max-configs-per-opcode=1 --min-instructions=100 --dump-object-to-disk=%t.o > %t.txt
+# RUN: llvm-objdump --triple=riscv64 -d %t.o | FileCheck %s --check-prefix=VFWREDUSUM
+# RUN: llvm-exegesis -mtriple=riscv64 -mcpu=sifive-x280 -benchmark-phase=assemble-measured-code --mode=latency --opcode-name=PseudoVSSRL_VX_MF4 \
+# RUN:    --max-configs-per-opcode=1 --min-instructions=100 --dump-object-to-disk=%t.o > %t.txt
+# RUN: llvm-objdump --triple=riscv64 -d %t.o | FileCheck %s --check-prefix=VSSRL
+
+# Make sure the correct VSETVL / VXRM write / FRM write instructions are generated
+# VFWREDUSUM: vsetvli {{.*}}, zero, e32, m1, tu, ma
+# VFWREDUSUM: fsrmi   {{.*}}, 0x0
+
+# VSSRL: vsetvli {{.*}}, zero, e8, mf4, tu, ma
+# VSSRL: csrwi   vxrm, 0x0
diff --git a/llvm/tools/llvm-exegesis/lib/MCInstrDescView.cpp b/llvm/tools/llvm-exegesis/lib/MCInstrDescView.cpp
index c002f68b427f7..e0e796cee8040 100644
--- a/llvm/tools/llvm-exegesis/lib/MCInstrDescView.cpp
+++ b/llvm/tools/llvm-exegesis/lib/MCInstrDescView.cpp
@@ -50,6 +50,8 @@ bool Operand::isTied() const { return TiedToIndex.has_value(); }
 
 bool Operand::isVariable() const { return VariableIndex.has_value(); }
 
+bool Operand::isEarlyClobber() const { return IsEarlyClobber; }
+
 bool Operand::isMemory() const {
   return isExplicit() &&
          getExplicitOperandInfo().OperandType == MCOI::OPERAND_MEMORY;
@@ -115,6 +117,8 @@ Instruction::create(const MCInstrInfo &InstrInfo,
     Operand Operand;
     Operand.Index = OpIndex;
     Operand.IsDef = (OpIndex < Description->getNumDefs());
+    Operand.IsEarlyClobber =
+        (Description->getOperandConstraint(OpIndex, MCOI::EARLY_CLOBBER) != -1);
     // TODO(gchatelet): Handle isLookupPtrRegClass.
     if (OpInfo.RegClass >= 0)
       Operand.Tracker = &RATC.getRegisterClass(OpInfo.RegClass);
diff --git a/llvm/tools/llvm-exegesis/lib/MCInstrDescView.h b/llvm/tools/llvm-exegesis/lib/MCInstrDescView.h
index c1af10fa460a3..0a62967897c79 100644
--- a/llvm/tools/llvm-exegesis/lib/MCInstrDescView.h
+++ b/llvm/tools/llvm-exegesis/lib/MCInstrDescView.h
@@ -72,6 +72,7 @@ struct Operand {
   bool isVariable() const;
   bool isMemory() const;
   bool isImmediate() const;
+  bool isEarlyClobber() const;
   unsigned getIndex() const;
   unsigned getTiedToIndex() const;
   unsigned getVariableIndex() const;
@@ -82,6 +83,7 @@ struct Operand {
   // Please use the accessors above and not the following fields.
   std::optional<uint8_t> Index;
   bool IsDef = false;
+  bool IsEarlyClobber = false;
   const RegisterAliasingTracker *Tracker = nullptr; // Set for Register Op.
   const MCOperandInfo *Info = nullptr;              // Set for Explicit Op.
   std::optional<uint8_t> TiedToIndex;               // Set for Reg&Explicit Op.
@@ -115,6 +117,8 @@ struct Instruction {
   Instruction &operator=(const Instruction &) = delete;
   Instruction &operator=(Instruction &&) = delete;
 
+  unsigned getOpcode() const { return Description.getOpcode(); }
+
   // Returns the Operand linked to this Variable.
   // In case the Variable is tied, the primary (i.e. Def) Operand is returned.
   const Operand &getPrimaryOperand(const Variable &Var) const;
diff --git a/llvm/tools/llvm-exegesis/lib/RISCV/CMakeLists.txt b/llvm/tools/llvm-exegesis/lib/RISCV/CMakeLists.txt
index 489ac6d6e34b3..d379874fa1d0e 100644
--- a/llvm/tools/llvm-exegesis/lib/RISCV/CMakeLists.txt
+++ b/llvm/tools/llvm-exegesis/lib/RISCV/CMakeLists.txt
@@ -14,6 +14,8 @@ set(LLVM_LINK_COMPONENTS
 add_llvm_library(LLVMExegesisRISCV
   DISABLE_LLVM_LINK_LLVM_DYLIB
   STATIC
+  RISCVExegesisPreprocessing.cpp
+  RISCVExegesisPostprocessing.cpp
   Target.cpp
 
   DEPENDS
diff --git a/llvm/tools/llvm-exegesis/lib/RISCV/RISCVExegesisPasses.h b/llvm/tools/llvm-exegesis/lib/RISCV/RISCVExegesisPasses.h
new file mode 100644
index 0000000000000..f206966331756
--- /dev/null
+++ b/llvm/tools/llvm-exegesis/lib/RISCV/RISCVExegesisPasses.h
@@ -0,0 +1,19 @@
+//===- RISCVExegesisPasses.h - RISC-V specific Exegesis Passes --*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_TOOLS_EXEGESIS_LIB_RISCV_RISCVEXEGESISPASSES_H
+#define LLVM_TOOLS_EXEGESIS_LIB_RISCV_RISCVEXEGESISPASSES_H
+namespace llvm {
+class FunctionPass;
+
+namespace exegesis {
+FunctionPass *createRISCVPreprocessingPass();
+FunctionPass *createRISCVPostprocessingPass();
+} // namespace exegesis
+} // namespace llvm
+#endif
diff --git a/llvm/tools/llvm-exegesis/lib/RISCV/RISCVExegesisPostprocessing.cpp b/llvm/tools/llvm-exegesis/lib/RISCV/RISCVExegesisPostprocessing.cpp
new file mode 100644
index 0000000000000..e25cf04a01d9e
--- /dev/null
+++ b/llvm/tools/llvm-exegesis/lib/RISCV/RISCVExegesisPostprocessing.cpp
@@ -0,0 +1,130 @@
+//===- RISCVExegesisPostprocessing.cpp - Post processing MI for exegesis---===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+// \file
+// Currently there is only one post-processing we need to do for exegesis:
+// Assign a physical register to VSETVL's rd if it's not X0 (i.e. VLMAX).
+//
+//===----------------------------------------------------------------------===//
+
+#include "RISCV.h"
+#include "RISCVExegesisPasses.h"
+#include "llvm/CodeGen/MachineFunctionPass.h"
+#include "llvm/CodeGen/MachineRegisterInfo.h"
+#include "llvm/Support/Debug.h"
+
+using namespace llvm;
+
+#define DEBUG_TYPE "riscv-exegesis-post-processing"
+
+namespace {
+struct RISCVExegesisPostprocessing : public MachineFunctionPass {
+  static char ID;
+
+  RISCVExegesisPostprocessing() : MachineFunctionPass(ID) {}
+
+  bool runOnMachineFunction(MachineFunction &MF) override;
+
+  void getAnalysisUsage(AnalysisUsage &AU) const override {
+    AU.setPreservesCFG();
+    MachineFunctionPass::getAnalysisUsage(AU);
+  }
+
+private:
+  // Extremely simple register allocator that picks a register that hasn't
+  // been defined or used in this function.
+  Register allocateGPRRegister(const MachineFunction &MF,
+                               const MachineRegisterInfo &MRI);
+
+  bool processVSETVL(MachineInstr &MI, MachineRegisterInfo &MRI);
+  bool processWriteFRM(MachineInstr &MI, MachineRegisterInfo &MRI);
+};
+} // anonymous namespace
+
+char RISCVExegesisPostprocessing::ID = 0;
+
+bool RISCVExegesisPostprocessing::runOnMachineFunction(MachineFunction &MF) {
+  bool Changed = false;
+  for (auto &MBB : MF)
+    for (auto &MI : MBB) {
+      unsigned Opcode = MI.getOpcode();
+      switch (Opcode) {
+      case RISCV::VSETVLI:
+      case RISCV::VSETVL:
+      case RISCV::PseudoVSETVLI:
+      case RISCV::PseudoVSETVLIX0:
+        Changed |= processVSETVL(MI, MF.getRegInfo());
+        break;
+      case RISCV::SwapFRMImm:
+      case RISCV::WriteFRM:
+        Changed |= processWriteFRM(MI, MF.getRegInfo());
+        break;
+      default:
+        break;
+      }
+    }
+
+  if (Changed)
+    MF.getRegInfo().clearVirtRegs();
+
+  LLVM_DEBUG(MF.print(dbgs() << "===After RISCVExegesisPostprocessing===\n");
+             dbgs() << "\n");
+
+  return Changed;
+}
+
+Register RISCVExegesisPostprocessing::allocateGPRRegister(
+    const MachineFunction &MF, const MachineRegisterInfo &MRI) {
+  const auto &TRI = *MRI.getTargetRegisterInfo();
+
+  const TargetRegisterClass *GPRClass =
+      TRI.getRegClass(RISCV::GPRJALRRegClassID);
+  BitVector Candidates = TRI.getAllocatableSet(MF, GPRClass);
+
+  for (unsigned SetIdx : Candidates.set_bits()) {
+    if (MRI.reg_empty(Register(SetIdx)))
+      return Register(SetIdx);
+  }
+
+  // All bets are off, assign a fixed one.
+  return RISCV::X5;
+}
+
+bool RISCVExegesisPostprocessing::processVSETVL(MachineInstr &MI,
+                                                MachineRegisterInfo &MRI) {
+  bool Changed = false;
+  // Replace both AVL and VL (i.e. the result) operands with physical
+  // registers.
+  for (unsigned Idx = 0U; Idx < 2;...
[truncated]

@@ -53,6 +53,8 @@ computeAliasingInstructions(const LLVMState &State, const Instruction *Instr,
if (OtherOpcode == Instr->Description.getOpcode())
continue;
const Instruction &OtherInstr = State.getIC().getInstr(OtherOpcode);
if (ET.getIgnoredOpcodeReasonOrNull(State, OtherInstr.getOpcode()))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some reason this filter was removed when RISCV's exegesis was first introduced. But it really should be here.

Copy link

github-actions bot commented Feb 25, 2025

⚠️ C/C++ code formatter, clang-format found issues in your code. ⚠️

You can test this locally with the following command:
git-clang-format --diff 3968ebd00da80a08de84f83a101ebb23710f6631 2147220a8199644656b7ebf3bfc3deca0d16870c --extensions h,cpp -- llvm/tools/llvm-exegesis/lib/RISCV/RISCVExegesisPasses.h llvm/tools/llvm-exegesis/lib/RISCV/RISCVExegesisPostprocessing.cpp llvm/tools/llvm-exegesis/lib/RISCV/RISCVExegesisPreprocessing.cpp llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h llvm/tools/llvm-exegesis/lib/MCInstrDescView.cpp llvm/tools/llvm-exegesis/lib/MCInstrDescView.h llvm/tools/llvm-exegesis/lib/RISCV/Target.cpp llvm/tools/llvm-exegesis/lib/SerialSnippetGenerator.cpp llvm/tools/llvm-exegesis/lib/Target.cpp llvm/tools/llvm-exegesis/lib/Target.h llvm/tools/llvm-exegesis/llvm-exegesis.cpp
View the diff from clang-format here.
diff --git a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h
index 135aec0c81..275ee0c286 100644
--- a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h
+++ b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h
@@ -427,13 +427,7 @@ inline static bool isValidRoundingMode(unsigned Mode) {
 } // namespace RISCVFPRndMode
 
 namespace RISCVVXRndMode {
-enum RoundingMode {
-  RNU = 0,
-  RNE = 1,
-  RDN = 2,
-  ROD = 3,
-  Invalid
-};
+enum RoundingMode { RNU = 0, RNE = 1, RDN = 2, ROD = 3, Invalid };
 
 inline static StringRef roundingModeToString(RoundingMode RndMode) {
   switch (RndMode) {

// - Zfinx registers
// Generate 'NOP' so that exegesis treats such registers as initialized
// (it tries to initialize them with '0' anyway).
return {nop()};
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem of using NOPs here is that if these registers are considered initialized, Exegesis would start to track liveness on the MachineFunction. But we don't have proper code to actually initialize these registers, so MachineVerifier would complain about using uninitialized registers.

It's a lot easier to just leave these registers uninitialized for now.

void addTargetSpecificPasses(PassManagerBase &PM) const override {
// Turn AVL operand of physical registers into virtual registers.
PM.add(exegesis::createRISCVPreprocessingPass());
PM.add(createRISCVInsertVSETVLIPass());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this require InsertVSETVLI to continue working on MIR without live intervals set up? @lukel97 do we plan to make VSETVLI insertion require live intervals?

Copy link
Collaborator

@topperc topperc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mshockwave mshockwave merged commit c253e5c into llvm:main Feb 28, 2025
10 of 11 checks passed
@mshockwave mshockwave deleted the patch/rvv-exegesis branch February 28, 2025 19:23
@llvm-ci
Copy link
Collaborator

llvm-ci commented Feb 28, 2025

LLVM Buildbot has detected a new failure on builder clang-ppc64le-linux-multistage running on ppc64le-clang-multistage-test while building llvm at step 4 "build stage 1".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/76/builds/7363

Here is the relevant piece of the build log for the reference
Step 4 (build stage 1) failure: 'ninja' (failure)
...
[6124/6292] Creating library symlink lib/libclangTidyMain.so
[6125/6292] Linking CXX executable bin/clang-tidy
[6126/6292] Linking CXX shared library lib/libLLVMAMDGPUCodeGen.so.21.0git
[6127/6292] Creating library symlink lib/libLLVMAMDGPUCodeGen.so
[6128/6292] Building CXX object lib/Target/RISCV/CMakeFiles/LLVMRISCVCodeGen.dir/GISel/RISCVInstructionSelector.cpp.o
[6129/6292] Linking CXX shared library lib/libLLVMRISCVCodeGen.so.21.0git
[6130/6292] Creating library symlink lib/libLLVMRISCVCodeGen.so
[6131/6292] Linking CXX static library lib/libLLVMExegesisRISCV_static.a
[6132/6292] Linking CXX static library lib/libLLVMOptDriver_static.a
[6133/6292] Linking CXX shared library lib/libLLVMExegesisRISCV.so.21.0git
FAILED: lib/libLLVMExegesisRISCV.so.21.0git 
: && /usr/lib64/ccache/c++ -fPIC -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -fno-lifetime-dse -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wno-comment -Wno-misleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG  -Wl,-z,defs -Wl,-z,nodelete   -Wl,-rpath-link,/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/./lib  -Wl,--gc-sections -shared -Wl,-soname,libLLVMExegesisRISCV.so.21.0git -o lib/libLLVMExegesisRISCV.so.21.0git tools/llvm-exegesis/lib/RISCV/CMakeFiles/obj.LLVMExegesisRISCV.dir/RISCVExegesisPreprocessing.cpp.o tools/llvm-exegesis/lib/RISCV/CMakeFiles/obj.LLVMExegesisRISCV.dir/RISCVExegesisPostprocessing.cpp.o tools/llvm-exegesis/lib/RISCV/CMakeFiles/obj.LLVMExegesisRISCV.dir/Target.cpp.o  -Wl,-rpath,"\$ORIGIN/../lib:/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/lib:"  lib/libLLVMRISCVCodeGen.so.21.0git  lib/libLLVMRISCVAsmParser.so.21.0git  lib/libLLVMRISCVDisassembler.so.21.0git  lib/libLLVMExegesis.so.21.0git  lib/libLLVMRISCVDesc.so.21.0git  lib/libLLVMRISCVInfo.so.21.0git  lib/libLLVMCodeGen.so.21.0git  lib/libLLVMCore.so.21.0git  lib/libLLVMSupport.so.21.0git  -Wl,-rpath-link,/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/lib && :
tools/llvm-exegesis/lib/RISCV/CMakeFiles/obj.LLVMExegesisRISCV.dir/Target.cpp.o: In function `llvm::exegesis::(anonymous namespace)::ExegesisRISCVTarget::createSerialSnippetGenerator(llvm::exegesis::LLVMState const&, llvm::exegesis::SnippetGenerator::Options const&) const':
Target.cpp:(.text._ZNK4llvm8exegesis12_GLOBAL__N_119ExegesisRISCVTarget28createSerialSnippetGeneratorERKNS0_9LLVMStateERKNS0_16SnippetGenerator7OptionsE+0x200): undefined reference to `llvm::MCSubtargetInfo::checkFeatures(llvm::StringRef) const'
Target.cpp:(.text._ZNK4llvm8exegesis12_GLOBAL__N_119ExegesisRISCVTarget28createSerialSnippetGeneratorERKNS0_9LLVMStateERKNS0_16SnippetGenerator7OptionsE+0x290): undefined reference to `llvm::MCSubtargetInfo::checkFeatures(llvm::StringRef) const'
tools/llvm-exegesis/lib/RISCV/CMakeFiles/obj.LLVMExegesisRISCV.dir/Target.cpp.o: In function `llvm::exegesis::(anonymous namespace)::ExegesisRISCVTarget::createParallelSnippetGenerator(llvm::exegesis::LLVMState const&, llvm::exegesis::SnippetGenerator::Options const&) const':
Target.cpp:(.text._ZNK4llvm8exegesis12_GLOBAL__N_119ExegesisRISCVTarget30createParallelSnippetGeneratorERKNS0_9LLVMStateERKNS0_16SnippetGenerator7OptionsE+0x200): undefined reference to `llvm::MCSubtargetInfo::checkFeatures(llvm::StringRef) const'
Target.cpp:(.text._ZNK4llvm8exegesis12_GLOBAL__N_119ExegesisRISCVTarget30createParallelSnippetGeneratorERKNS0_9LLVMStateERKNS0_16SnippetGenerator7OptionsE+0x290): undefined reference to `llvm::MCSubtargetInfo::checkFeatures(llvm::StringRef) const'
tools/llvm-exegesis/lib/RISCV/CMakeFiles/obj.LLVMExegesisRISCV.dir/Target.cpp.o: In function `llvm::exegesis::(anonymous namespace)::RISCVSnippetGenerator<llvm::exegesis::ParallelSnippetGenerator>::annotateWithVType(llvm::exegesis::CodeTemplate const&, llvm::exegesis::Instruction const&, unsigned int, llvm::BitVector const&, std::vector<llvm::exegesis::CodeTemplate, std::allocator<llvm::exegesis::CodeTemplate> >&) const [clone .isra.388]':
Target.cpp:(.text._ZNK4llvm8exegesis12_GLOBAL__N_121RISCVSnippetGeneratorINS0_24ParallelSnippetGeneratorEE17annotateWithVTypeERKNS0_12CodeTemplateERKNS0_11InstructionEjRKNS_9BitVectorERSt6vectorIS5_SaIS5_EE.isra.388+0x524): undefined reference to `llvm::RISCVVType::decodeVLMUL(llvm::RISCVVType::VLMUL)'
Target.cpp:(.text._ZNK4llvm8exegesis12_GLOBAL__N_121RISCVSnippetGeneratorINS0_24ParallelSnippetGeneratorEE17annotateWithVTypeERKNS0_12CodeTemplateERKNS0_11InstructionEjRKNS_9BitVectorERSt6vectorIS5_SaIS5_EE.isra.388+0xb44): undefined reference to `llvm::MCOperand::print(llvm::raw_ostream&, llvm::MCRegisterInfo const*) const'
Target.cpp:(.text._ZNK4llvm8exegesis12_GLOBAL__N_121RISCVSnippetGeneratorINS0_24ParallelSnippetGeneratorEE17annotateWithVTypeERKNS0_12CodeTemplateERKNS0_11InstructionEjRKNS_9BitVectorERSt6vectorIS5_SaIS5_EE.isra.388+0x1c1c): undefined reference to `llvm::RISCVVType::decodeVLMUL(llvm::RISCVVType::VLMUL)'
tools/llvm-exegesis/lib/RISCV/CMakeFiles/obj.LLVMExegesisRISCV.dir/Target.cpp.o: In function `llvm::exegesis::(anonymous namespace)::RISCVSnippetGenerator<llvm::exegesis::SerialSnippetGenerator>::annotateWithVType(llvm::exegesis::CodeTemplate const&, llvm::exegesis::Instruction const&, unsigned int, llvm::BitVector const&, std::vector<llvm::exegesis::CodeTemplate, std::allocator<llvm::exegesis::CodeTemplate> >&) const':
Target.cpp:(.text._ZNK4llvm8exegesis12_GLOBAL__N_121RISCVSnippetGeneratorINS0_22SerialSnippetGeneratorEE17annotateWithVTypeERKNS0_12CodeTemplateERKNS0_11InstructionEjRKNS_9BitVectorERSt6vectorIS5_SaIS5_EE+0x9e8): undefined reference to `llvm::MCOperand::print(llvm::raw_ostream&, llvm::MCRegisterInfo const*) const'
Target.cpp:(.text._ZNK4llvm8exegesis12_GLOBAL__N_121RISCVSnippetGeneratorINS0_22SerialSnippetGeneratorEE17annotateWithVTypeERKNS0_12CodeTemplateERKNS0_11InstructionEjRKNS_9BitVectorERSt6vectorIS5_SaIS5_EE+0x18a0): undefined reference to `llvm::RISCVVType::decodeVLMUL(llvm::RISCVVType::VLMUL)'
Target.cpp:(.text._ZNK4llvm8exegesis12_GLOBAL__N_121RISCVSnippetGeneratorINS0_22SerialSnippetGeneratorEE17annotateWithVTypeERKNS0_12CodeTemplateERKNS0_11InstructionEjRKNS_9BitVectorERSt6vectorIS5_SaIS5_EE+0x204c): undefined reference to `llvm::RISCVVType::decodeVLMUL(llvm::RISCVVType::VLMUL)'
collect2: error: ld returned 1 exit status
[6134/6292] Linking CXX executable bin/llvm-isel-fuzzer
[6135/6292] Linking CXX shared library lib/libclangHandleCXX.so.21.0git
[6136/6292] Linking CXX shared library lib/libLTO.so.21.0git
[6137/6292] Linking CXX executable bin/llvm-libtool-darwin
[6138/6292] Linking CXX shared library lib/libclangDependencyScanning.so.21.0git
[6139/6292] Linking CXX executable bin/llc
[6140/6292] Linking C executable bin/clang-fuzzer-dictionary
[6141/6292] Linking CXX executable bin/llvm-split
[6142/6292] Linking CXX executable bin/llvm-lto2
[6143/6292] Linking CXX executable bin/llvm-dwp
[6144/6292] Linking CXX shared library lib/libLLVMOptDriver.so.21.0git
[6145/6292] Linking CXX executable bin/clang-sycl-linker
[6146/6292] Linking CXX executable bin/clang-offload-packager
[6147/6292] Linking CXX executable bin/llvm-opt-fuzzer
[6148/6292] Linking CXX executable bin/llvm-lipo
[6149/6292] Linking CXX executable bin/clang-linker-wrapper
[6150/6292] Linking CXX executable bin/llvm-gsymutil
[6151/6292] Linking CXX executable bin/dsymutil
[6152/6292] Linking CXX executable bin/bugpoint
[6153/6292] Linking CXX executable bin/llvm-lto
[6154/6292] Linking CXX executable bin/clang-nvlink-wrapper
[6155/6292] Linking CXX executable bin/llvm-reduce

@mshockwave
Copy link
Member Author

LLVM Buildbot has detected a new failure on builder clang-ppc64le-linux-multistage running on ppc64le-clang-multistage-test while building llvm at step 4 "build stage 1".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/76/builds/7363

Here is the relevant piece of the build log for the reference

This is fixed by 8c5cd77

@llvm-ci
Copy link
Collaborator

llvm-ci commented Feb 28, 2025

LLVM Buildbot has detected a new failure on builder clang-ppc64le-rhel running on ppc64le-clang-rhel-test while building llvm at step 5 "build-unified-tree".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/145/builds/5368

Here is the relevant piece of the build log for the reference
Step 5 (build-unified-tree) failure: build (failure)
...
104.574 [670/6/5753] Building AMDGPUGenGlobalISel.inc...
106.055 [670/5/5754] Building AMDGPUGenInstrInfo.inc...
106.879 [670/4/5755] Building AMDGPUGenRegisterBank.inc...
109.915 [669/4/5756] Building CXX object lib/Target/RISCV/CMakeFiles/LLVMRISCVCodeGen.dir/RISCVISelLowering.cpp.o
118.652 [669/3/5757] Building CXX object lib/Target/RISCV/CMakeFiles/LLVMRISCVCodeGen.dir/RISCVISelDAGToDAG.cpp.o
134.737 [669/2/5758] Building CXX object lib/Target/RISCV/CMakeFiles/LLVMRISCVCodeGen.dir/GISel/RISCVInstructionSelector.cpp.o
134.819 [668/2/5759] Linking CXX shared library lib/libLLVMRISCVCodeGen.so.21.0git
134.826 [667/2/5760] Creating library symlink lib/libLLVMRISCVCodeGen.so
134.841 [665/3/5761] Linking CXX static library lib/libLLVMExegesisRISCV_static.a
134.872 [665/2/5762] Linking CXX shared library lib/libLLVMExegesisRISCV.so.21.0git
FAILED: lib/libLLVMExegesisRISCV.so.21.0git 
: && /home/buildbots/llvm-external-buildbots/clang.19.1.7/bin/clang++ --gcc-toolchain=/gcc-toolchain/usr -fPIC -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG  -Wl,-z,defs -Wl,-z,nodelete -Wl,--color-diagnostics   -Wl,--gc-sections  -Xlinker --dependency-file=tools/llvm-exegesis/lib/RISCV/CMakeFiles/LLVMExegesisRISCV.dir/link.d -shared -Wl,-soname,libLLVMExegesisRISCV.so.21.0git -o lib/libLLVMExegesisRISCV.so.21.0git tools/llvm-exegesis/lib/RISCV/CMakeFiles/obj.LLVMExegesisRISCV.dir/RISCVExegesisPreprocessing.cpp.o tools/llvm-exegesis/lib/RISCV/CMakeFiles/obj.LLVMExegesisRISCV.dir/RISCVExegesisPostprocessing.cpp.o tools/llvm-exegesis/lib/RISCV/CMakeFiles/obj.LLVMExegesisRISCV.dir/Target.cpp.o  -Wl,-rpath,"\$ORIGIN/../lib:/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/build/lib:"  lib/libLLVMRISCVCodeGen.so.21.0git  lib/libLLVMRISCVAsmParser.so.21.0git  lib/libLLVMRISCVDisassembler.so.21.0git  lib/libLLVMExegesis.so.21.0git  lib/libLLVMRISCVDesc.so.21.0git  lib/libLLVMRISCVInfo.so.21.0git  lib/libLLVMCodeGen.so.21.0git  lib/libLLVMCore.so.21.0git  lib/libLLVMSupport.so.21.0git  -Wl,-rpath-link,/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/build/lib && :
ld.lld: error: undefined symbol: llvm::MCSubtargetInfo::checkFeatures(llvm::StringRef) const
>>> referenced by Target.cpp
>>>               tools/llvm-exegesis/lib/RISCV/CMakeFiles/obj.LLVMExegesisRISCV.dir/Target.cpp.o:(llvm::exegesis::(anonymous namespace)::ExegesisRISCVTarget::createSerialSnippetGenerator(llvm::exegesis::LLVMState const&, llvm::exegesis::SnippetGenerator::Options const&) const)
>>> referenced by Target.cpp
>>>               tools/llvm-exegesis/lib/RISCV/CMakeFiles/obj.LLVMExegesisRISCV.dir/Target.cpp.o:(llvm::exegesis::(anonymous namespace)::ExegesisRISCVTarget::createSerialSnippetGenerator(llvm::exegesis::LLVMState const&, llvm::exegesis::SnippetGenerator::Options const&) const)
>>> referenced by Target.cpp
>>>               tools/llvm-exegesis/lib/RISCV/CMakeFiles/obj.LLVMExegesisRISCV.dir/Target.cpp.o:(llvm::exegesis::(anonymous namespace)::ExegesisRISCVTarget::createParallelSnippetGenerator(llvm::exegesis::LLVMState const&, llvm::exegesis::SnippetGenerator::Options const&) const)
>>> referenced 1 more times

ld.lld: error: undefined symbol: llvm::RISCVVType::decodeVLMUL(llvm::RISCVVType::VLMUL)
>>> referenced by Target.cpp
>>>               tools/llvm-exegesis/lib/RISCV/CMakeFiles/obj.LLVMExegesisRISCV.dir/Target.cpp.o:(llvm::exegesis::(anonymous namespace)::RISCVSnippetGenerator<llvm::exegesis::SerialSnippetGenerator>::annotateWithVType(llvm::exegesis::CodeTemplate const&, llvm::exegesis::Instruction const&, unsigned int, llvm::BitVector const&, std::vector<llvm::exegesis::CodeTemplate, std::allocator<llvm::exegesis::CodeTemplate>>&) const)
>>> referenced by Target.cpp
>>>               tools/llvm-exegesis/lib/RISCV/CMakeFiles/obj.LLVMExegesisRISCV.dir/Target.cpp.o:(llvm::exegesis::(anonymous namespace)::RISCVSnippetGenerator<llvm::exegesis::SerialSnippetGenerator>::annotateWithVType(llvm::exegesis::CodeTemplate const&, llvm::exegesis::Instruction const&, unsigned int, llvm::BitVector const&, std::vector<llvm::exegesis::CodeTemplate, std::allocator<llvm::exegesis::CodeTemplate>>&) const)
>>> referenced by Target.cpp
>>>               tools/llvm-exegesis/lib/RISCV/CMakeFiles/obj.LLVMExegesisRISCV.dir/Target.cpp.o:(llvm::exegesis::(anonymous namespace)::RISCVSnippetGenerator<llvm::exegesis::ParallelSnippetGenerator>::generateCodeTemplates(llvm::exegesis::InstructionTemplate, llvm::BitVector const&) const)
>>> referenced 1 more times

ld.lld: error: undefined symbol: llvm::MCOperand::print(llvm::raw_ostream&, llvm::MCRegisterInfo const*) const
>>> referenced by Target.cpp
>>>               tools/llvm-exegesis/lib/RISCV/CMakeFiles/obj.LLVMExegesisRISCV.dir/Target.cpp.o:(llvm::exegesis::(anonymous namespace)::RISCVSnippetGenerator<llvm::exegesis::SerialSnippetGenerator>::annotateWithVType(llvm::exegesis::CodeTemplate const&, llvm::exegesis::Instruction const&, unsigned int, llvm::BitVector const&, std::vector<llvm::exegesis::CodeTemplate, std::allocator<llvm::exegesis::CodeTemplate>>&) const)
>>> referenced by Target.cpp
>>>               tools/llvm-exegesis/lib/RISCV/CMakeFiles/obj.LLVMExegesisRISCV.dir/Target.cpp.o:(llvm::exegesis::(anonymous namespace)::RISCVSnippetGenerator<llvm::exegesis::ParallelSnippetGenerator>::generateCodeTemplates(llvm::exegesis::InstructionTemplate, llvm::BitVector const&) const)
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
148.907 [665/1/5763] Building InstCombineTables.inc...
ninja: build stopped: subcommand failed.

@llvm-ci
Copy link
Collaborator

llvm-ci commented Feb 28, 2025

LLVM Buildbot has detected a new failure on builder llvm-clang-x86_64-expensive-checks-ubuntu running on as-builder-4 while building llvm at step 6 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/187/builds/4579

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM :: tools/llvm-exegesis/RISCV/rvv/explicit-sew.test' FAILED ********************
Exit Code: 134

Command Output (stderr):
--
RUN: at line 1: /home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/build/bin/llvm-exegesis -mtriple=riscv64 -mcpu=sifive-x280 -benchmark-phase=assemble-measured-code --mode=latency --opcode-name=PseudoVFWREDUSUM_VS_M1_E32     --max-configs-per-opcode=1000 --min-instructions=100 | /home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/build/bin/FileCheck /home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/llvm-project/llvm/test/tools/llvm-exegesis/RISCV/rvv/explicit-sew.test
+ /home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/build/bin/llvm-exegesis -mtriple=riscv64 -mcpu=sifive-x280 -benchmark-phase=assemble-measured-code --mode=latency --opcode-name=PseudoVFWREDUSUM_VS_M1_E32 --max-configs-per-opcode=1000 --min-instructions=100
+ /home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/build/bin/FileCheck /home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/llvm-project/llvm/test/tools/llvm-exegesis/RISCV/rvv/explicit-sew.test
llvm-exegesis: /home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/llvm-project/llvm/include/llvm/CodeGen/Register.h:83: unsigned int llvm::Register::virtRegIndex() const: Assertion `isVirtual() && "Not a virtual register"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.	Program arguments: /home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/build/bin/llvm-exegesis -mtriple=riscv64 -mcpu=sifive-x280 -benchmark-phase=assemble-measured-code --mode=latency --opcode-name=PseudoVFWREDUSUM_VS_M1_E32 --max-configs-per-opcode=1000 --min-instructions=100
1.	Running pass 'Function Pass Manager' on module 'ExegesisInfoTest'.
2.	Running pass 'Verify generated machine code' on function '@foo'
 #0 0x000055aaa724f03a llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/llvm-project/llvm/lib/Support/Unix/Signals.inc:804:22
 #1 0x000055aaa724f45b PrintStackTraceSignalHandler(void*) /home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/llvm-project/llvm/lib/Support/Unix/Signals.inc:880:1
 #2 0x000055aaa724c889 llvm::sys::RunSignalHandlers() /home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/llvm-project/llvm/lib/Support/Signals.cpp:105:20
 #3 0x000055aaa724e8a9 SignalHandler(int, siginfo_t*, void*) /home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/llvm-project/llvm/lib/Support/Unix/Signals.inc:418:13
 #4 0x00007f252877c520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #5 0x00007f25287d09fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #6 0x00007f252877c476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #7 0x00007f25287627f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #8 0x00007f252876271b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
 #9 0x00007f2528773e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#10 0x000055aaa7318e9a llvm::Register::virtRegIndex() const /home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/llvm-project/llvm/include/llvm/CodeGen/Register.h:84:12
#11 0x000055aaa731a4b7 llvm::VirtReg2IndexFunctor::operator()(llvm::Register) const /home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/llvm-project/llvm/include/llvm/CodeGen/TargetRegisterInfo.h:1404:72
#12 0x000055aaa731c657 llvm::IndexedMap<std::pair<llvm::PointerUnion<llvm::TargetRegisterClass const*, llvm::RegisterBank const*>, llvm::MachineOperand*>, llvm::VirtReg2IndexFunctor>::operator[](llvm::Register) const /home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/llvm-project/llvm/include/llvm/ADT/IndexedMap.h:53:7
#13 0x000055aaa731adbc llvm::MachineRegisterInfo::getRegClass(llvm::Register) const /home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/llvm-project/llvm/include/llvm/CodeGen/MachineRegisterInfo.h:656:5
#14 0x000055aaa8629d6e llvm::RISCVInstrInfo::verifyInstruction(llvm::MachineInstr const&, llvm::StringRef&) const /home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/llvm-project/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp:2617:0
#15 0x000055aaa9b4e50b (anonymous namespace)::MachineVerifier::visitMachineInstrBefore(llvm::MachineInstr const*) /home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/llvm-project/llvm/lib/CodeGen/MachineVerifier.cpp:2361:7
#16 0x000055aaa9b44965 (anonymous namespace)::MachineVerifier::verify(llvm::MachineFunction const&) /home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/llvm-project/llvm/lib/CodeGen/MachineVerifier.cpp:554:21
#17 0x000055aaa9b43c48 (anonymous namespace)::MachineVerifierLegacyPass::runOnMachineFunction(llvm::MachineFunction&) /home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/llvm-project/llvm/lib/CodeGen/MachineVerifier.cpp:390:5
#18 0x000055aaa9a055b6 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) /home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/llvm-project/llvm/lib/CodeGen/MachineFunctionPass.cpp:108:30
#19 0x000055aaab1dd1b2 llvm::FPPassManager::runOnFunction(llvm::Function&) /home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1406:20
#20 0x000055aaab1dd562 llvm::FPPassManager::runOnModule(llvm::Module&) /home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1452:13
#21 0x000055aaab1dd9e3 (anonymous namespace)::MPPassManager::runOnModule(llvm::Module&) /home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1521:20
#22 0x000055aaab1d88a3 llvm::legacy::PassManagerImpl::run(llvm::Module&) /home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:539:13
#23 0x000055aaab1de32d llvm::legacy::PassManager::run(llvm::Module&) /home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1649:1
#24 0x000055aaa89ef37c llvm::exegesis::assembleToStream(llvm::exegesis::ExegesisTarget const&, std::unique_ptr<llvm::TargetMachine, std::default_delete<llvm::TargetMachine>>, llvm::ArrayRef<llvm::MCRegister>, std::function<void (llvm::exegesis::FunctionFiller&)> const&, llvm::raw_pwrite_stream&, llvm::exegesis::BenchmarkKey const&, bool) /home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/llvm-project/llvm/tools/llvm-exegesis/lib/Assembler.cpp:339:24
#25 0x000055aaa896657d llvm::exegesis::BenchmarkRunner::assembleSnippet(llvm::exegesis::BenchmarkCode const&, llvm::exegesis::SnippetRepetitor const&, unsigned int, unsigned int, bool) const /home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/llvm-project/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp:604:49
#26 0x000055aaa89668c3 llvm::exegesis::BenchmarkRunner::getRunnableConfiguration(llvm::exegesis::BenchmarkCode const&, unsigned int, unsigned int, llvm::exegesis::SnippetRepetitor const&) const /home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/llvm-project/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp:639:75
#27 0x000055aaa6f9fae0 llvm::exegesis::runBenchmarkConfigurations(llvm::exegesis::LLVMState const&, llvm::ArrayRef<llvm::exegesis::BenchmarkCode>, llvm::ArrayRef<std::unique_ptr<llvm::exegesis::SnippetRepetitor const, std::default_delete<llvm::exegesis::SnippetRepetitor const>>>, llvm::exegesis::BenchmarkRunner const&) /home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/llvm-project/llvm/tools/llvm-exegesis/llvm-exegesis.cpp:422:66
#28 0x000055aaa6fa0b24 llvm::exegesis::benchmarkMain() /home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/llvm-project/llvm/tools/llvm-exegesis/llvm-exegesis.cpp:581:20
#29 0x000055aaa6fa18c3 main /home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/llvm-project/llvm/tools/llvm-exegesis/llvm-exegesis.cpp:736:10
#30 0x00007f2528763d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#31 0x00007f2528763e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#32 0x000055aaa6f9eaa5 _start (/home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/build/bin/llvm-exegesis+0x5c1aa5)
/home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/build/test/tools/llvm-exegesis/RISCV/rvv/Output/explicit-sew.test.script: line 1: 3677315 Aborted                 (core dumped) /home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/build/bin/llvm-exegesis -mtriple=riscv64 -mcpu=sifive-x280 -benchmark-phase=assemble-measured-code --mode=latency --opcode-name=PseudoVFWREDUSUM_VS_M1_E32 --max-configs-per-opcode=1000 --min-instructions=100
     3677318 Done                    | /home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/build/bin/FileCheck /home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/llvm-project/llvm/test/tools/llvm-exegesis/RISCV/rvv/explicit-sew.test

...

@llvm-ci
Copy link
Collaborator

llvm-ci commented Feb 28, 2025

LLVM Buildbot has detected a new failure on builder clang-s390x-linux running on systemz-1 while building llvm at step 5 "ninja check 1".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/42/builds/3471

Here is the relevant piece of the build log for the reference
Step 5 (ninja check 1) failure: stage 1 checked (failure)
******************** TEST 'LLVM :: tools/llvm-exegesis/RISCV/rvv/filter.test' FAILED ********************
Exit Code: 2

Command Output (stderr):
--
RUN: at line 1: /home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/bin/llvm-exegesis -mtriple=riscv64 -mcpu=sifive-x280 -benchmark-phase=assemble-measured-code --mode=inverse_throughput --opcode-name=PseudoVNCLIPU_WX_M1_MASK     --riscv-filter-config='vtype = {VXRM: rod, AVL: VLMAX, SEW: e(8|16), Policy: ta/mu}' --max-configs-per-opcode=1000 --min-instructions=100 | /home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/bin/FileCheck /home/uweigand/sandbox/buildbot/clang-s390x-linux/llvm/llvm/test/tools/llvm-exegesis/RISCV/rvv/filter.test
+ /home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/bin/llvm-exegesis -mtriple=riscv64 -mcpu=sifive-x280 -benchmark-phase=assemble-measured-code --mode=inverse_throughput --opcode-name=PseudoVNCLIPU_WX_M1_MASK '--riscv-filter-config=vtype = {VXRM: rod, AVL: VLMAX, SEW: e(8|16), Policy: ta/mu}' --max-configs-per-opcode=1000 --min-instructions=100
+ /home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/bin/FileCheck /home/uweigand/sandbox/buildbot/clang-s390x-linux/llvm/llvm/test/tools/llvm-exegesis/RISCV/rvv/filter.test
PseudoVNCLIPU_WX_M1_MASK: Failed to produce any snippet via: instruction has tied variables, avoiding Read-After-Write issue, picking random def and use registers not aliasing each other, for uses, one unique register for each position
FileCheck error: '<stdin>' is empty.
FileCheck command line:  /home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/bin/FileCheck /home/uweigand/sandbox/buildbot/clang-s390x-linux/llvm/llvm/test/tools/llvm-exegesis/RISCV/rvv/filter.test

--

********************


@mshockwave
Copy link
Member Author

LLVM Buildbot has detected a new failure on builder llvm-clang-x86_64-expensive-checks-ubuntu running on as-builder-4 while building llvm at step 6 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/187/builds/4579

Here is the relevant piece of the build log for the reference

Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM :: tools/llvm-exegesis/RISCV/rvv/explicit-sew.test' FAILED ********************
Exit Code: 134

Command Output (stderr):
--
RUN: at line 1: /home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/build/bin/llvm-exegesis -mtriple=riscv64 -mcpu=sifive-x280 -benchmark-phase=assemble-measured-code --mode=latency --opcode-name=PseudoVFWREDUSUM_VS_M1_E32     --max-configs-per-opcode=1000 --min-instructions=100 | /home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/build/bin/FileCheck /home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/llvm-project/llvm/test/tools/llvm-exegesis/RISCV/rvv/explicit-sew.test
+ /home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/build/bin/llvm-exegesis -mtriple=riscv64 -mcpu=sifive-x280 -benchmark-phase=assemble-measured-code --mode=latency --opcode-name=PseudoVFWREDUSUM_VS_M1_E32 --max-configs-per-opcode=1000 --min-instructions=100
+ /home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/build/bin/FileCheck /home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/llvm-project/llvm/test/tools/llvm-exegesis/RISCV/rvv/explicit-sew.test
llvm-exegesis: /home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/llvm-project/llvm/include/llvm/CodeGen/Register.h:83: unsigned int llvm::Register::virtRegIndex() const: Assertion `isVirtual() && "Not a virtual register"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.	Program arguments: /home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/build/bin/llvm-exegesis -mtriple=riscv64 -mcpu=sifive-x280 -benchmark-phase=assemble-measured-code --mode=latency --opcode-name=PseudoVFWREDUSUM_VS_M1_E32 --max-configs-per-opcode=1000 --min-instructions=100
1.	Running pass 'Function Pass Manager' on module 'ExegesisInfoTest'.
2.	Running pass 'Verify generated machine code' on function '@foo'
 #0 0x000055aaa724f03a llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/llvm-project/llvm/lib/Support/Unix/Signals.inc:804:22
 #1 0x000055aaa724f45b PrintStackTraceSignalHandler(void*) /home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/llvm-project/llvm/lib/Support/Unix/Signals.inc:880:1
 #2 0x000055aaa724c889 llvm::sys::RunSignalHandlers() /home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/llvm-project/llvm/lib/Support/Signals.cpp:105:20
 #3 0x000055aaa724e8a9 SignalHandler(int, siginfo_t*, void*) /home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/llvm-project/llvm/lib/Support/Unix/Signals.inc:418:13
 #4 0x00007f252877c520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #5 0x00007f25287d09fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #6 0x00007f252877c476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #7 0x00007f25287627f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #8 0x00007f252876271b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
 #9 0x00007f2528773e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#10 0x000055aaa7318e9a llvm::Register::virtRegIndex() const /home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/llvm-project/llvm/include/llvm/CodeGen/Register.h:84:12
#11 0x000055aaa731a4b7 llvm::VirtReg2IndexFunctor::operator()(llvm::Register) const /home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/llvm-project/llvm/include/llvm/CodeGen/TargetRegisterInfo.h:1404:72
#12 0x000055aaa731c657 llvm::IndexedMap<std::pair<llvm::PointerUnion<llvm::TargetRegisterClass const*, llvm::RegisterBank const*>, llvm::MachineOperand*>, llvm::VirtReg2IndexFunctor>::operator[](llvm::Register) const /home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/llvm-project/llvm/include/llvm/ADT/IndexedMap.h:53:7
#13 0x000055aaa731adbc llvm::MachineRegisterInfo::getRegClass(llvm::Register) const /home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/llvm-project/llvm/include/llvm/CodeGen/MachineRegisterInfo.h:656:5
#14 0x000055aaa8629d6e llvm::RISCVInstrInfo::verifyInstruction(llvm::MachineInstr const&, llvm::StringRef&) const /home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/llvm-project/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp:2617:0
#15 0x000055aaa9b4e50b (anonymous namespace)::MachineVerifier::visitMachineInstrBefore(llvm::MachineInstr const*) /home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/llvm-project/llvm/lib/CodeGen/MachineVerifier.cpp:2361:7
#16 0x000055aaa9b44965 (anonymous namespace)::MachineVerifier::verify(llvm::MachineFunction const&) /home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/llvm-project/llvm/lib/CodeGen/MachineVerifier.cpp:554:21
#17 0x000055aaa9b43c48 (anonymous namespace)::MachineVerifierLegacyPass::runOnMachineFunction(llvm::MachineFunction&) /home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/llvm-project/llvm/lib/CodeGen/MachineVerifier.cpp:390:5
#18 0x000055aaa9a055b6 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) /home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/llvm-project/llvm/lib/CodeGen/MachineFunctionPass.cpp:108:30
#19 0x000055aaab1dd1b2 llvm::FPPassManager::runOnFunction(llvm::Function&) /home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1406:20
#20 0x000055aaab1dd562 llvm::FPPassManager::runOnModule(llvm::Module&) /home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1452:13
#21 0x000055aaab1dd9e3 (anonymous namespace)::MPPassManager::runOnModule(llvm::Module&) /home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1521:20
#22 0x000055aaab1d88a3 llvm::legacy::PassManagerImpl::run(llvm::Module&) /home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:539:13
#23 0x000055aaab1de32d llvm::legacy::PassManager::run(llvm::Module&) /home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1649:1
#24 0x000055aaa89ef37c llvm::exegesis::assembleToStream(llvm::exegesis::ExegesisTarget const&, std::unique_ptr<llvm::TargetMachine, std::default_delete<llvm::TargetMachine>>, llvm::ArrayRef<llvm::MCRegister>, std::function<void (llvm::exegesis::FunctionFiller&)> const&, llvm::raw_pwrite_stream&, llvm::exegesis::BenchmarkKey const&, bool) /home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/llvm-project/llvm/tools/llvm-exegesis/lib/Assembler.cpp:339:24
#25 0x000055aaa896657d llvm::exegesis::BenchmarkRunner::assembleSnippet(llvm::exegesis::BenchmarkCode const&, llvm::exegesis::SnippetRepetitor const&, unsigned int, unsigned int, bool) const /home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/llvm-project/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp:604:49
#26 0x000055aaa89668c3 llvm::exegesis::BenchmarkRunner::getRunnableConfiguration(llvm::exegesis::BenchmarkCode const&, unsigned int, unsigned int, llvm::exegesis::SnippetRepetitor const&) const /home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/llvm-project/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp:639:75
#27 0x000055aaa6f9fae0 llvm::exegesis::runBenchmarkConfigurations(llvm::exegesis::LLVMState const&, llvm::ArrayRef<llvm::exegesis::BenchmarkCode>, llvm::ArrayRef<std::unique_ptr<llvm::exegesis::SnippetRepetitor const, std::default_delete<llvm::exegesis::SnippetRepetitor const>>>, llvm::exegesis::BenchmarkRunner const&) /home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/llvm-project/llvm/tools/llvm-exegesis/llvm-exegesis.cpp:422:66
#28 0x000055aaa6fa0b24 llvm::exegesis::benchmarkMain() /home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/llvm-project/llvm/tools/llvm-exegesis/llvm-exegesis.cpp:581:20
#29 0x000055aaa6fa18c3 main /home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/llvm-project/llvm/tools/llvm-exegesis/llvm-exegesis.cpp:736:10
#30 0x00007f2528763d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#31 0x00007f2528763e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#32 0x000055aaa6f9eaa5 _start (/home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/build/bin/llvm-exegesis+0x5c1aa5)
/home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/build/test/tools/llvm-exegesis/RISCV/rvv/Output/explicit-sew.test.script: line 1: 3677315 Aborted                 (core dumped) /home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/build/bin/llvm-exegesis -mtriple=riscv64 -mcpu=sifive-x280 -benchmark-phase=assemble-measured-code --mode=latency --opcode-name=PseudoVFWREDUSUM_VS_M1_E32 --max-configs-per-opcode=1000 --min-instructions=100
     3677318 Done                    | /home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/build/bin/FileCheck /home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/llvm-project/llvm/test/tools/llvm-exegesis/RISCV/rvv/explicit-sew.test

...

Fixed by b697bf3

@llvm-ci
Copy link
Collaborator

llvm-ci commented Feb 28, 2025

LLVM Buildbot has detected a new failure on builder clang-with-thin-lto-ubuntu running on as-worker-92 while building llvm at step 7 "test-stage1-compiler".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/127/builds/2556

Here is the relevant piece of the build log for the reference
Step 7 (test-stage1-compiler) failure: build (failure)
...
llvm-lit: /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/llvm/utils/lit/lit/llvm/config.py:512: note: using ld64.lld: /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/bin/ld64.lld
llvm-lit: /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/llvm/utils/lit/lit/llvm/config.py:512: note: using wasm-ld: /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/bin/wasm-ld
llvm-lit: /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/utils/lit/tests/lit.cfg:111: warning: Setting a timeout per test not supported. Requires the Python psutil module but it could not be found. Try installing it via pip or via your operating system's package manager.
 Some tests will be skipped and the --timeout command line argument will not work.
llvm-lit: /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/llvm/utils/lit/lit/llvm/config.py:512: note: using ld.lld: /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/bin/ld.lld
llvm-lit: /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/llvm/utils/lit/lit/llvm/config.py:512: note: using lld-link: /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/bin/lld-link
llvm-lit: /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/llvm/utils/lit/lit/llvm/config.py:512: note: using ld64.lld: /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/bin/ld64.lld
llvm-lit: /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/llvm/utils/lit/lit/llvm/config.py:512: note: using wasm-ld: /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/bin/wasm-ld
-- Testing: 83875 tests, 72 workers --
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80..
FAIL: LLVM :: tools/llvm-exegesis/RISCV/rvv/reduction.test (74191 of 83875)
******************** TEST 'LLVM :: tools/llvm-exegesis/RISCV/rvv/reduction.test' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 1: /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/bin/llvm-exegesis -mtriple=riscv64 -mcpu=sifive-p670 -benchmark-phase=assemble-measured-code --mode=latency --opcode-name=PseudoVWREDSUMU_VS_M8_E32 --min-instructions=100 |     /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/bin/FileCheck /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/llvm/test/tools/llvm-exegesis/RISCV/rvv/reduction.test
+ /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/bin/llvm-exegesis -mtriple=riscv64 -mcpu=sifive-p670 -benchmark-phase=assemble-measured-code --mode=latency --opcode-name=PseudoVWREDSUMU_VS_M8_E32 --min-instructions=100
+ /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/bin/FileCheck /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/llvm/test/tools/llvm-exegesis/RISCV/rvv/reduction.test
/home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/llvm/test/tools/llvm-exegesis/RISCV/rvv/reduction.test:7:14: error: CHECK-NOT: excluded string found in input
# CHECK-NOT: V[[REG:[0-9]+]] V[[REG]] V{{[0-9]+}}M8 V[[REG]]
             ^
<stdin>:5:31: note: found here
 - 'PseudoVWREDSUMU_VS_M8_E32 V9 V9 V8M8 V9 i_0xffffffffffffffff i_0x5 i_0x0'
                              ^~~~~~~~~~~~~
<stdin>:5:32: note: captured var "REG"
 - 'PseudoVWREDSUMU_VS_M8_E32 V9 V9 V8M8 V9 i_0xffffffffffffffff i_0x5 i_0x0'
                               ^

Input file: <stdin>
Check file: /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/llvm/test/tools/llvm-exegesis/RISCV/rvv/reduction.test

-dump-input=help explains the following input dump.

Input was:
<<<<<<
         1: --- 
         2: mode: latency 
         3: key: 
         4:  instructions: 
         5:  - 'PseudoVWREDSUMU_VS_M8_E32 V9 V9 V8M8 V9 i_0xffffffffffffffff i_0x5 i_0x0' 
not:7'0                                   !~~~~~~~~~~~~                                    error: no match expected
not:7'1                                    !                                               captured var "REG"
         6:  config: 'vtype = {AVL: VLMAX, SEW: e32, Policy: tu/mu}' 
         7:  register_initial_values: 
         8:  - 'V9=0x0' 
         9:  - 'V8M8=0x0' 
        10: cpu_name: sifive-p670 
         .

@mshockwave
Copy link
Member Author

LLVM Buildbot has detected a new failure on builder clang-with-thin-lto-ubuntu running on as-worker-92 while building llvm at step 7 "test-stage1-compiler".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/127/builds/2556

Here is the relevant piece of the build log for the reference

Step 7 (test-stage1-compiler) failure: build (failure)
...
llvm-lit: /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/llvm/utils/lit/lit/llvm/config.py:512: note: using ld64.lld: /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/bin/ld64.lld
llvm-lit: /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/llvm/utils/lit/lit/llvm/config.py:512: note: using wasm-ld: /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/bin/wasm-ld
llvm-lit: /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/utils/lit/tests/lit.cfg:111: warning: Setting a timeout per test not supported. Requires the Python psutil module but it could not be found. Try installing it via pip or via your operating system's package manager.
 Some tests will be skipped and the --timeout command line argument will not work.
llvm-lit: /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/llvm/utils/lit/lit/llvm/config.py:512: note: using ld.lld: /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/bin/ld.lld
llvm-lit: /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/llvm/utils/lit/lit/llvm/config.py:512: note: using lld-link: /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/bin/lld-link
llvm-lit: /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/llvm/utils/lit/lit/llvm/config.py:512: note: using ld64.lld: /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/bin/ld64.lld
llvm-lit: /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/llvm/utils/lit/lit/llvm/config.py:512: note: using wasm-ld: /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/bin/wasm-ld
-- Testing: 83875 tests, 72 workers --
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80..
FAIL: LLVM :: tools/llvm-exegesis/RISCV/rvv/reduction.test (74191 of 83875)
******************** TEST 'LLVM :: tools/llvm-exegesis/RISCV/rvv/reduction.test' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 1: /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/bin/llvm-exegesis -mtriple=riscv64 -mcpu=sifive-p670 -benchmark-phase=assemble-measured-code --mode=latency --opcode-name=PseudoVWREDSUMU_VS_M8_E32 --min-instructions=100 |     /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/bin/FileCheck /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/llvm/test/tools/llvm-exegesis/RISCV/rvv/reduction.test
+ /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/bin/llvm-exegesis -mtriple=riscv64 -mcpu=sifive-p670 -benchmark-phase=assemble-measured-code --mode=latency --opcode-name=PseudoVWREDSUMU_VS_M8_E32 --min-instructions=100
+ /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/bin/FileCheck /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/llvm/test/tools/llvm-exegesis/RISCV/rvv/reduction.test
/home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/llvm/test/tools/llvm-exegesis/RISCV/rvv/reduction.test:7:14: error: CHECK-NOT: excluded string found in input
# CHECK-NOT: V[[REG:[0-9]+]] V[[REG]] V{{[0-9]+}}M8 V[[REG]]
             ^
<stdin>:5:31: note: found here
 - 'PseudoVWREDSUMU_VS_M8_E32 V9 V9 V8M8 V9 i_0xffffffffffffffff i_0x5 i_0x0'
                              ^~~~~~~~~~~~~
<stdin>:5:32: note: captured var "REG"
 - 'PseudoVWREDSUMU_VS_M8_E32 V9 V9 V8M8 V9 i_0xffffffffffffffff i_0x5 i_0x0'
                               ^

Input file: <stdin>
Check file: /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/llvm/test/tools/llvm-exegesis/RISCV/rvv/reduction.test

-dump-input=help explains the following input dump.

Input was:
<<<<<<
         1: --- 
         2: mode: latency 
         3: key: 
         4:  instructions: 
         5:  - 'PseudoVWREDSUMU_VS_M8_E32 V9 V9 V8M8 V9 i_0xffffffffffffffff i_0x5 i_0x0' 
not:7'0                                   !~~~~~~~~~~~~                                    error: no match expected
not:7'1                                    !                                               captured var "REG"
         6:  config: 'vtype = {AVL: VLMAX, SEW: e32, Policy: tu/mu}' 
         7:  register_initial_values: 
         8:  - 'V9=0x0' 
         9:  - 'V8M8=0x0' 
        10: cpu_name: sifive-p670 
         .

Fixed by b2cc28c

@mshockwave
Copy link
Member Author

LLVM Buildbot has detected a new failure on builder clang-s390x-linux running on systemz-1 while building llvm at step 5 "ninja check 1".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/42/builds/3471

Here is the relevant piece of the build log for the reference

Step 5 (ninja check 1) failure: stage 1 checked (failure)
******************** TEST 'LLVM :: tools/llvm-exegesis/RISCV/rvv/filter.test' FAILED ********************
Exit Code: 2

Command Output (stderr):
--
RUN: at line 1: /home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/bin/llvm-exegesis -mtriple=riscv64 -mcpu=sifive-x280 -benchmark-phase=assemble-measured-code --mode=inverse_throughput --opcode-name=PseudoVNCLIPU_WX_M1_MASK     --riscv-filter-config='vtype = {VXRM: rod, AVL: VLMAX, SEW: e(8|16), Policy: ta/mu}' --max-configs-per-opcode=1000 --min-instructions=100 | /home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/bin/FileCheck /home/uweigand/sandbox/buildbot/clang-s390x-linux/llvm/llvm/test/tools/llvm-exegesis/RISCV/rvv/filter.test
+ /home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/bin/llvm-exegesis -mtriple=riscv64 -mcpu=sifive-x280 -benchmark-phase=assemble-measured-code --mode=inverse_throughput --opcode-name=PseudoVNCLIPU_WX_M1_MASK '--riscv-filter-config=vtype = {VXRM: rod, AVL: VLMAX, SEW: e(8|16), Policy: ta/mu}' --max-configs-per-opcode=1000 --min-instructions=100
+ /home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/bin/FileCheck /home/uweigand/sandbox/buildbot/clang-s390x-linux/llvm/llvm/test/tools/llvm-exegesis/RISCV/rvv/filter.test
PseudoVNCLIPU_WX_M1_MASK: Failed to produce any snippet via: instruction has tied variables, avoiding Read-After-Write issue, picking random def and use registers not aliasing each other, for uses, one unique register for each position
FileCheck error: '<stdin>' is empty.
FileCheck command line:  /home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/bin/FileCheck /home/uweigand/sandbox/buildbot/clang-s390x-linux/llvm/llvm/test/tools/llvm-exegesis/RISCV/rvv/filter.test

--

********************

Mitigated by 23c41bf

@llvm-ci
Copy link
Collaborator

llvm-ci commented Mar 1, 2025

LLVM Buildbot has detected a new failure on builder lld-x86_64-win running on as-worker-93 while building llvm at step 7 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/146/builds/2380

Here is the relevant piece of the build log for the reference
Step 7 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM-Unit :: Support/./SupportTests.exe/38/87' FAILED ********************
Script(shard):
--
GTEST_OUTPUT=json:C:\a\lld-x86_64-win\build\unittests\Support\.\SupportTests.exe-LLVM-Unit-17492-38-87.json GTEST_SHUFFLE=0 GTEST_TOTAL_SHARDS=87 GTEST_SHARD_INDEX=38 C:\a\lld-x86_64-win\build\unittests\Support\.\SupportTests.exe
--

Script:
--
C:\a\lld-x86_64-win\build\unittests\Support\.\SupportTests.exe --gtest_filter=ProgramEnvTest.CreateProcessLongPath
--
C:\a\lld-x86_64-win\llvm-project\llvm\unittests\Support\ProgramTest.cpp(160): error: Expected equality of these values:
  0
  RC
    Which is: -2

C:\a\lld-x86_64-win\llvm-project\llvm\unittests\Support\ProgramTest.cpp(163): error: fs::remove(Twine(LongPath)): did not return errc::success.
error number: 13
error message: permission denied



C:\a\lld-x86_64-win\llvm-project\llvm\unittests\Support\ProgramTest.cpp:160
Expected equality of these values:
  0
  RC
    Which is: -2

C:\a\lld-x86_64-win\llvm-project\llvm\unittests\Support\ProgramTest.cpp:163
fs::remove(Twine(LongPath)): did not return errc::success.
error number: 13
error message: permission denied




********************


@nico
Copy link
Contributor

nico commented Mar 1, 2025

It's unusual to include a FooSubtarget.h header outside of lib/Target (the subtarget header includes a bunch of llvm-tblgen'd files, so this serializes the build, etc). Is there a way to prevent this inclusion?

nico added a commit that referenced this pull request Mar 1, 2025
See here for the additional tblgen deps:
#128767 (comment)
llvm-sync bot pushed a commit to arm/arm-toolchain that referenced this pull request Mar 1, 2025
@llvm-ci
Copy link
Collaborator

llvm-ci commented Mar 1, 2025

LLVM Buildbot has detected a new failure on builder llvm-clang-x86_64-expensive-checks-win running on as-worker-93 while building llvm at step 7 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/14/builds/2709

Here is the relevant piece of the build log for the reference
Step 7 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM :: tools/llvm-exegesis/RISCV/rvv/skip-rm.test' FAILED ********************
Exit Code: 2147483651

Command Output (stdout):
--
# RUN: at line 1
c:\a\llvm-clang-x86_64-expensive-checks-win\build\bin\llvm-exegesis.exe -mtriple=riscv64 -mcpu=sifive-x280 -benchmark-phase=assemble-measured-code --mode=latency --opcode-name=PseudoVAADDU_VV_M1     --riscv-enumerate-rounding-modes=false --max-configs-per-opcode=1000 --min-instructions=100 | c:\a\llvm-clang-x86_64-expensive-checks-win\build\bin\filecheck.exe C:\a\llvm-clang-x86_64-expensive-checks-win\llvm-project\llvm\test\tools\llvm-exegesis\RISCV\rvv\skip-rm.test --check-prefix=VX
# executed command: 'c:\a\llvm-clang-x86_64-expensive-checks-win\build\bin\llvm-exegesis.exe' -mtriple=riscv64 -mcpu=sifive-x280 -benchmark-phase=assemble-measured-code --mode=latency --opcode-name=PseudoVAADDU_VV_M1 --riscv-enumerate-rounding-modes=false --max-configs-per-opcode=1000 --min-instructions=100
# .---command stderr------------
# | Assertion failed: isVirtual() && "Not a virtual register", file C:\a\llvm-clang-x86_64-expensive-checks-win\llvm-project\llvm\include\llvm/CodeGen/Register.h, line 83
# | PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
# | Stack dump:
# | 0.	Program arguments: c:\\a\\llvm-clang-x86_64-expensive-checks-win\\build\\bin\\llvm-exegesis.exe -mtriple=riscv64 -mcpu=sifive-x280 -benchmark-phase=assemble-measured-code --mode=latency --opcode-name=PseudoVAADDU_VV_M1 --riscv-enumerate-rounding-modes=false --max-configs-per-opcode=1000 --min-instructions=100
# | 1.	Running pass 'Function Pass Manager' on module 'ExegesisInfoTest'.
# | 2.	Running pass 'Verify generated machine code' on function '@foo'
# | Exception Code: 0x80000003
# |  #0 0x00007ff67c29a90c HandleAbort C:\a\llvm-clang-x86_64-expensive-checks-win\llvm-project\llvm\lib\Support\Windows\Signals.inc:429:0
# |  #1 0x00007ff8f50190ed (C:\WINDOWS\SYSTEM32\ucrtbased.dll+0xa90ed)
# |  #2 0x00007ff8f501ae49 (C:\WINDOWS\SYSTEM32\ucrtbased.dll+0xaae49)
# |  #3 0x00007ff8f5020c6f (C:\WINDOWS\SYSTEM32\ucrtbased.dll+0xb0c6f)
# |  #4 0x00007ff8f501eba1 (C:\WINDOWS\SYSTEM32\ucrtbased.dll+0xaeba1)
# |  #5 0x00007ff8f50218af (C:\WINDOWS\SYSTEM32\ucrtbased.dll+0xb18af)
# |  #6 0x00007ff67c47b121 llvm::Register::virtRegIndex(void) const C:\a\llvm-clang-x86_64-expensive-checks-win\llvm-project\llvm\include\llvm\CodeGen\Register.h:83:0
# |  #7 0x00007ff67c451378 llvm::VirtReg2IndexFunctor::operator()(class llvm::Register) const C:\a\llvm-clang-x86_64-expensive-checks-win\llvm-project\llvm\include\llvm\CodeGen\TargetRegisterInfo.h:1404:0
# |  #8 0x00007ff67c44fcfa llvm::IndexedMap<struct std::pair<class llvm::PointerUnion<class llvm::TargetRegisterClass const *, class llvm::RegisterBank const *>, class llvm::MachineOperand *>, struct llvm::VirtReg2IndexFunctor>::operator[](class llvm::Register) const C:\a\llvm-clang-x86_64-expensive-checks-win\llvm-project\llvm\include\llvm\ADT\IndexedMap.h:53:0
# |  #9 0x00007ff67c467d98 llvm::MachineRegisterInfo::getRegClass(class llvm::Register) const C:\a\llvm-clang-x86_64-expensive-checks-win\llvm-project\llvm\include\llvm\CodeGen\MachineRegisterInfo.h:656:0
# | #10 0x00007ff67e2a6707 llvm::RISCVInstrInfo::verifyInstruction(class llvm::MachineInstr const &, class llvm::StringRef &) const C:\a\llvm-clang-x86_64-expensive-checks-win\llvm-project\llvm\lib\Target\RISCV\RISCVInstrInfo.cpp:2617:0
# | #11 0x00007ff67fae553c `anonymous namespace'::MachineVerifier::visitMachineInstrBefore C:\a\llvm-clang-x86_64-expensive-checks-win\llvm-project\llvm\lib\CodeGen\MachineVerifier.cpp:2361:0
# | #12 0x00007ff67fada4e1 `anonymous namespace'::MachineVerifier::verify C:\a\llvm-clang-x86_64-expensive-checks-win\llvm-project\llvm\lib\CodeGen\MachineVerifier.cpp:553:0
# | #13 0x00007ff67faf18e3 `anonymous namespace'::MachineVerifierLegacyPass::runOnMachineFunction C:\a\llvm-clang-x86_64-expensive-checks-win\llvm-project\llvm\lib\CodeGen\MachineVerifier.cpp:390:0
# | #14 0x00007ff67f7a6760 llvm::MachineFunctionPass::runOnFunction(class llvm::Function &) C:\a\llvm-clang-x86_64-expensive-checks-win\llvm-project\llvm\lib\CodeGen\MachineFunctionPass.cpp:108:0
# | #15 0x00007ff68182332b llvm::FPPassManager::runOnFunction(class llvm::Function &) C:\a\llvm-clang-x86_64-expensive-checks-win\llvm-project\llvm\lib\IR\LegacyPassManager.cpp:1406:0
# | #16 0x00007ff681823842 llvm::FPPassManager::runOnModule(class llvm::Module &) C:\a\llvm-clang-x86_64-expensive-checks-win\llvm-project\llvm\lib\IR\LegacyPassManager.cpp:1452:0
# | #17 0x00007ff681826645 `anonymous namespace'::MPPassManager::runOnModule C:\a\llvm-clang-x86_64-expensive-checks-win\llvm-project\llvm\lib\IR\LegacyPassManager.cpp:1521:0
# | #18 0x00007ff6818275b9 llvm::legacy::PassManagerImpl::run(class llvm::Module &) C:\a\llvm-clang-x86_64-expensive-checks-win\llvm-project\llvm\lib\IR\LegacyPassManager.cpp:539:0
# | #19 0x00007ff68181c73c llvm::legacy::PassManager::run(class llvm::Module &) C:\a\llvm-clang-x86_64-expensive-checks-win\llvm-project\llvm\lib\IR\LegacyPassManager.cpp:1649:0
# | #20 0x00007ff67e47c42c llvm::exegesis::assembleToStream(class llvm::exegesis::ExegesisTarget const &, class std::unique_ptr<class llvm::TargetMachine, struct std::default_delete<class llvm::TargetMachine>>, class llvm::ArrayRef<class llvm::MCRegister>, class std::function<(class llvm::exegesis::FunctionFiller &)> const &, class llvm::raw_pwrite_stream &, struct llvm::exegesis::BenchmarkKey const &, bool) C:\a\llvm-clang-x86_64-expensive-checks-win\llvm-project\llvm\tools\llvm-exegesis\lib\Assembler.cpp:338:0
# | #21 0x00007ff67e45024f llvm::exegesis::BenchmarkRunner::assembleSnippet(struct llvm::exegesis::BenchmarkCode const &, class llvm::exegesis::SnippetRepetitor const &, unsigned int, unsigned int, bool) const C:\a\llvm-clang-x86_64-expensive-checks-win\llvm-project\llvm\tools\llvm-exegesis\lib\BenchmarkRunner.cpp:600:0
# | #22 0x00007ff67e44f013 llvm::exegesis::BenchmarkRunner::getRunnableConfiguration(struct llvm::exegesis::BenchmarkCode const &, unsigned int, unsigned int, class llvm::exegesis::SnippetRepetitor const &) const C:\a\llvm-clang-x86_64-expensive-checks-win\llvm-project\llvm\tools\llvm-exegesis\lib\BenchmarkRunner.cpp:637:0
# | #23 0x00007ff67bf971e1 llvm::exegesis::runBenchmarkConfigurations C:\a\llvm-clang-x86_64-expensive-checks-win\llvm-project\llvm\tools\llvm-exegesis\llvm-exegesis.cpp:421:0
# | #24 0x00007ff67bf98612 llvm::exegesis::benchmarkMain(void) C:\a\llvm-clang-x86_64-expensive-checks-win\build\include\llvm\Config\TargetExegesis.def:31:0
# | #25 0x00007ff67bf99df9 main C:\a\llvm-clang-x86_64-expensive-checks-win\llvm-project\llvm\tools\llvm-exegesis\llvm-exegesis.cpp:734:0
# | #26 0x00007ff681d23f09 invoke_main D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:79:0
# | #27 0x00007ff681d23df2 __scrt_common_main_seh D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288:0
# | #28 0x00007ff681d23cae __scrt_common_main D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:331:0
# | #29 0x00007ff681d23f9e mainCRTStartup D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_main.cpp:17:0
# | #30 0x00007ff90f397374 (C:\WINDOWS\System32\KERNEL32.DLL+0x17374)
# | #31 0x00007ff90fa5cc91 (C:\WINDOWS\SYSTEM32\ntdll.dll+0x4cc91)
# `-----------------------------
# error: command failed with exit status: 0x80000003
...

@mshockwave
Copy link
Member Author

It's unusual to include a FooSubtarget.h header outside of lib/Target (the subtarget header includes a bunch of llvm-tblgen'd files, so this serializes the build, etc). Is there a way to prevent this inclusion?

Good point. I've just created a PR for this: #129568

jph-13 pushed a commit to jph-13/llvm-project that referenced this pull request Mar 21, 2025
See here for the additional tblgen deps:
llvm#128767 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants