Skip to content

RISC-V CMake test defaults clobber e2e --iree-llvmcpu-target-cpu-features #24859

Description

@TMahlatini

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions