Related: #24769, #24802
Problem
On RISC-V Linux CMake builds, iree_compile_flags_for_platform always appends RISCV64_TEST_DEFAULT_LLVM_FLAGS, including --iree-llvmcpu-target-cpu-features=+m,+a,+f,+d,+c,+zvl512b,+v. iree_bytecode_module then puts those platform flags after the test variant's own flags. LLVM last-wins, so any TARGET_CPU_FEATURES_VARIANTS feature set is discarded.
The first casualty is riscv_64:ime:+v,+zvl256b,+xsmtvdot. The e2e target is named _ime but the vmfb is generic RVV at VLEN=512 with no +xsmtvdot.
Repro
Current CMake, build-riscv. Ninja line for e2e_matmul_cpu_dt_uk_i8_i32_llvm-cpu_local-task_ime_matmul.vmfb:
--iree-llvmcpu-target-cpu-features=+v,+zvl256b,+xsmtvdot
--iree-llvmcpu-target-triple=riscv64
--iree-llvmcpu-target-abi=lp64d
--iree-llvmcpu-target-cpu-features=+m,+a,+f,+d,+c,+zvl512b,+v
Second flag wins. Same order with host iree-compile on a 16×32 i8 matmul (--iree-opt-data-tiling --iree-llvmcpu-enable-ukernels=all) dumps:
cpu_features = "+m,+a,+f,+d,+c,+zvl512b,+v"
native_vector_size = 128
Tile is generic RVV linalg.mmt4d 7×64, not IME 12×16×8.
With a complete ISA (+m,+a,+f,+d,+c,+v,+zvl256b,+xsmtvdot) the dump is:
cpu_features = "+m,+a,+f,+d,+c,+v,+zvl256b,+xsmtvdot"
native_vector_size = 64
Tile is IME 12×16×8.
Suggested fix
main...TMahlatini:iree:users/tmahlatini/riscv-cpu-features-declobber
Related: #24769, #24802
Problem
On RISC-V Linux CMake builds,
iree_compile_flags_for_platformalways appendsRISCV64_TEST_DEFAULT_LLVM_FLAGS, including--iree-llvmcpu-target-cpu-features=+m,+a,+f,+d,+c,+zvl512b,+v.iree_bytecode_modulethen puts those platform flags after the test variant's own flags. LLVM last-wins, so anyTARGET_CPU_FEATURES_VARIANTSfeature set is discarded.The first casualty is
riscv_64:ime:+v,+zvl256b,+xsmtvdot. The e2e target is named_imebut the vmfb is generic RVV at VLEN=512 with no+xsmtvdot.Repro
Current CMake,
build-riscv. Ninja line fore2e_matmul_cpu_dt_uk_i8_i32_llvm-cpu_local-task_ime_matmul.vmfb:Second flag wins. Same order with host
iree-compileon a 16×32 i8 matmul (--iree-opt-data-tiling --iree-llvmcpu-enable-ukernels=all) dumps:Tile is generic RVV
linalg.mmt4d7×64, not IME12×16×8.With a complete ISA (
+m,+a,+f,+d,+c,+v,+zvl256b,+xsmtvdot) the dump is:Tile is IME
12×16×8.Suggested fix
main...TMahlatini:iree:users/tmahlatini/riscv-cpu-features-declobber