Before start
Branch
kunminghu-v3
Describe the bug
Executing any instruction from a large set of vector families causes the core to stop committing entirely: the instruction never retires, no trap is taken, and nothing commits afterwards. Reproducible with --no-diff (pure RTL), in M-mode or U-mode, with vstart = 0 or any other value — so it is neither a difftest artifact nor vstart-dependent.
Observed families (each verified by a PoC or by batch difftest runs): vid.v, viota.m, vwsll.{vi,vv,vx}, vandn.{vv,vx}, vrol.*, vror.*, vnclip/vnclipu (all forms), vnsra/vnsrl (all forms), vadc/vmadc/vmsbc, vslide1up/vslide1down/vslidedown, vrgather.vv, vrev8.v, vaaddu, and the whole widening arithmetic family vwmacc/vwmul/vwmaccu/vwmaccsu/vwmulsu/vwmulu/vwadd*/vwsub* (.vx/.vv/.wx/.vi forms).
Expected behavior
A legal vector instruction in a legal vector state must either execute and retire, or raise an exception. An implementation may choose to trap unsupported instructions with illegal-instruction, but must not stall the pipeline forever.
To Reproduce
- Build emu:
NOOP_HOME=$(pwd) make emu CONFIG=MinimalConfig EMU_THREADS=4 SIM_ARGS=--fpga-platform -j$(nproc)
- Save the PoC below as
poc.S and the linker script as link.ld, then compile:
riscv64-unknown-elf-gcc -nostdlib -nostartfiles -static -fno-pic -march=rv64gcv -mabi=lp64d -Wl,-T,link.ld -Wl,-e,_start -o poc.elf poc.S
- Run:
./build/emu -i poc.elf --no-diff --dump-commit-trace
- Observe: with
--dump-commit-trace the last committed instruction is the csrw vstart; vid.v never commits and the GOODTRAP marker is never reached (verified 30+ s). Substituting vwmacc.vx v0, x0, v2 (after vsetvli zero, t1, e32, m1) shows the same for the widening family.
PoC (VLEN=128):
.option norvc
.section .text.init
.globl _start
_start:
# Minimal execution environment: enable the vector extension (mstatus.VS = Dirty)
csrr t0, mstatus
ori t0, t0, 0x600
csrw mstatus, t0
vsetivli zero, 16, e8, m1, ta, ma # SEW=8, LMUL=1, vl=16 (all-legal)
csrw vstart, zero
vid.v v0 # <<< BUG TRIGGER: legal instruction, never
# retires; nothing commits afterwards
# (no trap is taken either).
.4byte 0x0000006b # GOODTRAP marker - never reached
1: j 1b
Linker script (link.ld):
OUTPUT_ARCH("riscv")
ENTRY(_start)
SECTIONS {
. = 0x80000000;
.text.init : { KEEP(*(.text.init)) }
. = ALIGN(0x1000); .text : { *(.text .text.*) }
. = ALIGN(0x1000); .data : { *(.data .data.* .sdata .sdata.*) }
.bss (NOLOAD) : { *(.bss .bss.* COMMON) }
/DISCARD/ : { *(.comment) *(.note*) *(.riscv.attributes) }
}
Environment
- Hardware
- CPU: AMD EPYC 7543 32-Core Processor (128 threads)
- Memory (GB): 247
- Storage (GB): 2000
- Software
- Operating system: Ubuntu 26.04.1 LTS
- gcc version: riscv64-unknown-elf-gcc (14.2.0+19) 14.2.0
- java version: openjdk version "25.0.2" 2026-01-20
- mill version: Mill Build Tool version 0.12.17
- Repo
- XiangShan commit id:
c8d7b3a
- Build & Run
- Build command:
NOOP_HOME=$(pwd) make emu CONFIG=MinimalConfig EMU_THREADS=4 SIM_ARGS=--fpga-platform -j$(nproc)
- Run command:
./build/emu -i poc.elf --no-diff --dump-commit-trace
Before start
Branch
kunminghu-v3
Describe the bug
Executing any instruction from a large set of vector families causes the core to stop committing entirely: the instruction never retires, no trap is taken, and nothing commits afterwards. Reproducible with
--no-diff(pure RTL), in M-mode or U-mode, withvstart = 0or any other value — so it is neither a difftest artifact nor vstart-dependent.Observed families (each verified by a PoC or by batch difftest runs):
vid.v,viota.m,vwsll.{vi,vv,vx},vandn.{vv,vx},vrol.*,vror.*,vnclip/vnclipu(all forms),vnsra/vnsrl(all forms),vadc/vmadc/vmsbc,vslide1up/vslide1down/vslidedown,vrgather.vv,vrev8.v,vaaddu, and the whole widening arithmetic familyvwmacc/vwmul/vwmaccu/vwmaccsu/vwmulsu/vwmulu/vwadd*/vwsub*(.vx/.vv/.wx/.vi forms).Expected behavior
A legal vector instruction in a legal vector state must either execute and retire, or raise an exception. An implementation may choose to trap unsupported instructions with illegal-instruction, but must not stall the pipeline forever.
To Reproduce
NOOP_HOME=$(pwd) make emu CONFIG=MinimalConfig EMU_THREADS=4 SIM_ARGS=--fpga-platform -j$(nproc)poc.Sand the linker script aslink.ld, then compile:riscv64-unknown-elf-gcc -nostdlib -nostartfiles -static -fno-pic -march=rv64gcv -mabi=lp64d -Wl,-T,link.ld -Wl,-e,_start -o poc.elf poc.S./build/emu -i poc.elf --no-diff --dump-commit-trace--dump-commit-tracethe last committed instruction is thecsrw vstart;vid.vnever commits and the GOODTRAP marker is never reached (verified 30+ s). Substitutingvwmacc.vx v0, x0, v2(aftervsetvli zero, t1, e32, m1) shows the same for the widening family.PoC (VLEN=128):
Linker script (
link.ld):Environment
c8d7b3aNOOP_HOME=$(pwd) make emu CONFIG=MinimalConfig EMU_THREADS=4 SIM_ARGS=--fpga-platform -j$(nproc)./build/emu -i poc.elf --no-diff --dump-commit-trace