fix(vmi): fix VMI vmula layout and masked lowering - #1475
Open
TelGome wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
摘要
修复 VMI
vmula的 layout 传播、mask lowering 和 masked 浮点语义问题。本次修改让带 mask 的
vmula保留在 VMI 到 VPTO 的转换流程中,确保各个操作数使用兼容的 layout,并正确生成 packed contiguous predicate。
问题背景
vmi_vmulasimulator 测试暴露出以下编译器问题:vmula过早降级为 legacy FMA,导致 predicate 和pmode="zero"语义丢失。vmula的操作数可能保留不兼容的 VMI layout,触发 verifier 错误和VMI 到 VPTO 转换阶段的 residual operation。
lane_stride=2)可能生成不完整的物理predicate,或者导致
create_mask无法完成转换。修改内容
VMIVmulaOp的acc、lhs、rhs和 result 属于同一个 datalayout 等价类,同时不改变全局
unite()的原有行为。vmula不再提前转换为无 mask 的 legacy FMA,而是保留到VMI 到 VPTO lowering 阶段处理。
VMIVmulaOp的 VMI 到 VPTO 转换,包括物理分块数量、mask 数量校验,以及 unmasked 操作的全 true mask 生成。
pmode="zero":使用降低后的 predicate,在计算结果和零向量之间进行选择,从而清除 inactive lane。
正 stride layout 的 mask materialization。
整数
vmula仍然映射到原生pto.vmula路径。本次 PR 不修改 simulator对整数
RV_VMULA的支持问题。验证结果
PTOASCompiler。vmi_vmula_bf16_vl256_g1_a0_z_prefix:PASS。vmi_vmula_f32_vl256_g1_a128_z_prefix:PASS。vmi_vmula_bf16_vl64_g1_a64_n_nomask:PASS。i16_vl64和i8_vl128用例不再出现VMI-RESIDUAL-OP转换失败。git diff --check:PASS。剩余24 cases 的整数 simulator
RV_VMULA/type.S8失败属于独立的 simulator 能力问题fix #1374