Skip to content

fix(vmi): 256-lane vgather iota signless + opt-in bitcast layout_hint - #1487

Open
liuzidi wants to merge 3 commits into
hw-native-sys:masterfrom
liuzidi:fix/vmi-vgather-signless-and-layout-hint
Open

fix(vmi): 256-lane vgather iota signless + opt-in bitcast layout_hint#1487
liuzidi wants to merge 3 commits into
hw-native-sys:masterfrom
liuzidi:fix/vmi-vgather-signless-and-layout-hint

Conversation

@liuzidi

@liuzidi liuzidi commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator

Refs #1486(完整背景、最小复现与实测数据见 issue)。

内容

  1. vgather iota signless 修复(VMIToVPTO.cpp):256-lane iota chunk 拆分产生的 unsigned 标量常量与偏移加法改为经 signless 同宽位恒等转换。此前任何 256-lane vgather(ui16 index ramp)在 vmi-to-vpto 阶段硬失败 'integer return type must be signless';128-lane 单 chunk 不触发。
  2. opt-in layout_hint 软偏好(VMILayoutPropagation.cpp + VMILowerUnifiedToLegacy.cpp + 表行):vinterpret_cast 的 layout_hint attr 转发到 bitcast,传播时追加 {hint,hint} candidate relation。软语义——求解器冲突时可拒绝,全局启发式不变。配套 ensure_layout 表行 {bits<32>, N<128>, d(4), c()} 仅在 hinted 转换路径触达。

验证

  • 目标 kernel(256-lane bf16 dequant)端到端编译 + 硬件位级 7/7;
  • lit 全套 1704 pass / 227 fail,与无 patch 基线逐项一致(227 为本机环境既有失败);
  • 950DT 生产 per-channel cast gate 复验:round 10 档 ratio 与基线完全一致(无全局污染)。

liuzidi and others added 3 commits September 1, 2026 11:19
1. createScalarOffsetConstant / createIotaChunkBase: unsigned scalar
   constants and offset adds must round-trip through signless integer
   types of the same width (bit-identical); the 256-lane iota chunk
   split previously emitted arith.constant :ui16 / ui16 arith.addi,
   failing vmi-to-vpto with 'integer return type must be signless'
   for every 256-lane vgather on a ui16 index ramp.

2. Opt-in layout soft preference: a layout_hint attribute on
   vinterpret_cast (forwarded to the lowered bitcast) appends its
   layout pair as an extra candidate relation in
   VMIBitcastTransfer::query. Soft semantics only — the solver may
   reject the candidate when other constraints conflict, so the
   global layout heuristics are untouched (lit suite verified
   identical before/after). Includes the opt-in {bits<32>, N<128>,
   d(4), c()} ensure_layout row consumed by hinted conversions.

Refs hw-native-sys#1486
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant