)]}'
{
  "commit": "bc908fd620d7378d1e2da0bff6ee70d77a965110",
  "tree": "71a7b03495dca7b586d8a2bd8a7f56ced1cee637",
  "parents": [
    "e53a335559976a31ed23225480a1baff823d2888"
  ],
  "author": {
    "name": "Zmicier Prybysh",
    "email": "zprybysh@baylibre.com",
    "time": "Wed Jul 22 14:07:17 2026 +0200"
  },
  "committer": {
    "name": "GitHub",
    "email": "noreply@github.com",
    "time": "Wed Jul 22 12:07:17 2026 +0000"
  },
  "message": "[LLVMCPU][RISCV] Add RVV bf16 mmt4d ukernel using the Zvfbfwma widening MAC (bf16*bf16-\u003ef32) (#24695)\n\n## Summary\n\nOn RISC-V, a data-tiled bf16 matmul was computed by promoting LHS/RHS to\nf32, ignoring the `Zvfbfwma` bf16 widening multiply-accumulate extension\n(`vfwmaccbf16`) that LLVM already lowers to and that shipping silicon\nimplements. This PR adds a native `bf16 x bf16 -\u003e f32` `mmt4d`\nmicrokernel for RVV+`Zvfbfwma`. Naturally, this change is related to\n(and was implementing looking at) the existing f32, `int8` (#23734), and\nf16/`Zvfh` (#22231) ukernels.\n\n## How the change was tested\n\n1. Compiler e2e\nA `128x256 bf16 * 256x128 bf16 -\u003e 128x128 f32` matmul compiled for\n`riscv64 +v,+zvfbfwma` with `--iree-opt-data-tiling\n--iree-llvmcpu-enable-ukernels\u003dall`:\n   Before: dispatch contains `arith.extf` f32-promotion, no ukernel.\nAfter: `Mmt4dTilingExpert` dispatch `matmul_128x128x256_bf16xbf16xf32`\nwith `iree_uk_mmt4d` + `iree_uk_pack`; **zero `arith.extf`**; all four\n`iree_uk_mmt4d_tile_bf16bf16f32_*_riscv_64_zvfbfwma` symbols present;\ngenerated RISC-V asm inner loop is `vfwmaccbf16.vf`.\n2. Numerics under `qemu-riscv64`\nA standalone harness calling the real tile functions matches an f32\nreference exactly. A control run without the extension crashes,\nconfirming `vfwmaccbf16` is genuinely executed. I used qemu 8.2 which\nexposes the extension as the experimental `-cpu max,x-zvfbfwma\u003dtrue`\nproperty.\n3. Tile selection under `qemu-riscv64`.\nVerified `iree_uk_mmt4d_select_tile_func_arch` (the\n`entry_point.c`/`tiles.inl` wiring) returns the correct bf16 tile for\neach M0 value when `cpu_data` has the `Zvfbfwma` bit, and does not\nselect it when the bit is clear — i.e. the feature is only enabled for\n`Zvfbfwma`.\n4. In-tree `mmt4d_test`.\nThe added case exercises the same path in CI\u0027s RISC-V cross-build (falls\nback to the generic tile if the CI toolchain can\u0027t assemble `Zvfbfwma`,\ni think it\u0027s the same limitation as `Zvfh` in #22303).\n\n### A note on CI coverage\n\nIf I understand correctly, the RISC-V CI job runs under an older\n`qemu-riscv64` on a stock `rv64gcv` profile that doesn\u0027t expose\n`Zvfbfwma`, and `mmt4d_test` *skips* (does not fail) any case whose\nfeature the runtime CPU lacks. Zvfbfwma is only assembled/executed on a\ntoolchain + qemu new enough to support it (qemu ≥ 8.2 exposes it as the\nexperimental `x-zvfbfwma` property). My point is: a green CI does not\nmean the bf16 kernel ran in CI — the functional validation of record is\nthe local `qemu-riscv64` 8.2 numerics + tile-selection runs described\nabove.\n\nDisclosure: this change was assisted by Claude Code, but the change was\nreviewed and thoroughly tested before being submitted.\n\n---------\n\nSigned-off-by: Zmicier Prybysh \u003czprybysh@baylibre.com\u003e",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "a7ed1afa2d40a786e4bd0ce9846885431e32943a",
      "old_mode": 33188,
      "old_path": "compiler/src/iree/compiler/Codegen/Common/test/materialize_encoding_riscv.mlir",
      "new_id": "327a0692f7fd290d0717f05e1f2e06fc2e047abb",
      "new_mode": 33188,
      "new_path": "compiler/src/iree/compiler/Codegen/Common/test/materialize_encoding_riscv.mlir"
    },
    {
      "type": "modify",
      "old_id": "cd144972ac94cfc4b610d4f6fea748ec9d1b42cf",
      "old_mode": 33188,
      "old_path": "compiler/src/iree/compiler/Codegen/ExternalInterfaces/CPUEncodingExternalModels.cpp",
      "new_id": "e3d2324d01bf47a642b7344ae476eb1917f32a9e",
      "new_mode": 33188,
      "new_path": "compiler/src/iree/compiler/Codegen/ExternalInterfaces/CPUEncodingExternalModels.cpp"
    },
    {
      "type": "modify",
      "old_id": "108ca5b2424722a051df8f98a30525b39de916c5",
      "old_mode": 33188,
      "old_path": "runtime/src/iree/builtins/ukernel/arch/riscv_64/BUILD.bazel",
      "new_id": "b41e2f4be1bacf612917e213b4c7e213da710f87",
      "new_mode": 33188,
      "new_path": "runtime/src/iree/builtins/ukernel/arch/riscv_64/BUILD.bazel"
    },
    {
      "type": "modify",
      "old_id": "b02f6c765b94493e537ea54039623913bcc92b40",
      "old_mode": 33188,
      "old_path": "runtime/src/iree/builtins/ukernel/arch/riscv_64/CMakeLists.txt",
      "new_id": "7cd59ef8acc0cf72efa78b14078ec4dd37429cdf",
      "new_mode": 33188,
      "new_path": "runtime/src/iree/builtins/ukernel/arch/riscv_64/CMakeLists.txt"
    },
    {
      "type": "modify",
      "old_id": "62942fd037d6a26c61378282757d883be3655eed",
      "old_mode": 33188,
      "old_path": "runtime/src/iree/builtins/ukernel/arch/riscv_64/common_riscv_64.h",
      "new_id": "b68d9610e56ed5eb45f65fa6651b5e539a8cdb26",
      "new_mode": 33188,
      "new_path": "runtime/src/iree/builtins/ukernel/arch/riscv_64/common_riscv_64.h"
    },
    {
      "type": "modify",
      "old_id": "42858b83ee38bca603c9ec844d04e7a4525b3e19",
      "old_mode": 33188,
      "old_path": "runtime/src/iree/builtins/ukernel/arch/riscv_64/config_riscv_64.h.in",
      "new_id": "bee185d6099174f5d29ac83a3d935c5780409ae7",
      "new_mode": 33188,
      "new_path": "runtime/src/iree/builtins/ukernel/arch/riscv_64/config_riscv_64.h.in"
    },
    {
      "type": "modify",
      "old_id": "1c2668042959d606f00bb07587d8ba8f424a31a4",
      "old_mode": 33188,
      "old_path": "runtime/src/iree/builtins/ukernel/arch/riscv_64/mmt4d_riscv_64_entry_point.c",
      "new_id": "bdde1c57c54b4cf74fe94f6d0791ed15249326d0",
      "new_mode": 33188,
      "new_path": "runtime/src/iree/builtins/ukernel/arch/riscv_64/mmt4d_riscv_64_entry_point.c"
    },
    {
      "type": "modify",
      "old_id": "7e8713fc098d542af6728bac648122d2837c96e0",
      "old_mode": 33188,
      "old_path": "runtime/src/iree/builtins/ukernel/arch/riscv_64/mmt4d_riscv_64_tiles.inl",
      "new_id": "c67baa595ad1696001e23da75a826b4de4bf0d17",
      "new_mode": 33188,
      "new_path": "runtime/src/iree/builtins/ukernel/arch/riscv_64/mmt4d_riscv_64_tiles.inl"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "7a7a3e93c8592734ffd2aa7a8e1dac3ac51d02cd",
      "new_mode": 33188,
      "new_path": "runtime/src/iree/builtins/ukernel/arch/riscv_64/mmt4d_riscv_64_zvfbfwma.c"
    },
    {
      "type": "modify",
      "old_id": "d9314674ee7430a77ba1d83702f2b7fb20fe76ef",
      "old_mode": 33188,
      "old_path": "runtime/src/iree/builtins/ukernel/tools/mmt4d_test.c",
      "new_id": "8b6e17a65fa161b8c14e11ed77d80ec2401fe20e",
      "new_mode": 33188,
      "new_path": "runtime/src/iree/builtins/ukernel/tools/mmt4d_test.c"
    },
    {
      "type": "modify",
      "old_id": "95e92a37a013336415b15b22dcf2d4b84e76334e",
      "old_mode": 33188,
      "old_path": "runtime/src/iree/schemas/cpu_feature_bits.inl",
      "new_id": "b634143794f28013bd14f1f61a86092e686a6032",
      "new_mode": 33188,
      "new_path": "runtime/src/iree/schemas/cpu_feature_bits.inl"
    }
  ]
}
