fix(vmi): VMI legality checks, vsstb op, and PTODSL VMI surface enforcement - #1087
Merged
zhangstevenunity merged 9 commits intoAug 5, 2026
Merged
Conversation
Zhendong404
force-pushed
the
improve-vmi-legality-check
branch
3 times, most recently
from
August 2, 2026 03:05
a822e58 to
df7c720
Compare
…ng and saturation
Zhendong404
force-pushed
the
improve-vmi-legality-check
branch
from
August 4, 2026 13:26
df7c720 to
09d8bf2
Compare
6 tasks
A3 板测完成(有跳过)
|
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.
Summary
Strengthens VMI legality validation and closes PTODSL surface gaps, rebased on current
hwsys/main.Fixes #1058
New op
feat(vmi): add vmi.vsstb implementation— adds the block-strided store op with a required mask and fixed zero repeat stride, plus lowering guards:pmode="merge"is now rejected by both the verifier (clear diagnostic) and the legacy lowering instead of being silently dropped.VMI legality checks
fix(vmi): improve legality check for vmi.vload/vstore— memory element compatibility, block-stride/mask rules, and group divisibility are checked in all mode branches.fix(vmi): enhance vcvt conversion attributes— rounding/saturation attribute validation with positive/negative tests.fix(vmi): enforce legal lane counts for vreg and mask— unified group verifiers align with the documented domain.fix(vmi): add UB-backed memory verification for gather/scatter—vgather/vgatherb/vscatterreject non-UB memory operands at verify time.PTODSL surface
fix(ptodsl): enforce VMI lane-count whitelist on vinterpret_cast— the lane count derived byvinterpret_castis checked against{1,2,4,8,64,128,256}(previously8xf32 -> si8silently produced32lanes, bypassing the constructor whitelist); the source layout is only preserved when the lane count is unchanged, and a layout-assigned source across a lane-count change is rejected instead of reusing a stale group/slot layout.test(ptodsl): improve coverage of vmi dsl tests— inventory/emission coverage for the formalpto.vminamespace.Test fixes
fix(test): fix failed lit testcases— updatestadd_*andsoft_postupdateexpectations to the deterministic lowering output (constant ordering,set_mask_norm, shared vs duplicated-1constants) and fixes thevmi_gather_scatter_address_space_invalidRUN line.Validation
check-pto: 1538/1539 pass (1 unsupported: vfsim-costmodel feature off)check-dsl: 25/25 passSegfault fix
Root cause
pto.merge_jit_modules()built each kernel in an independent MLIRContext, then directly cloned operations from later modules into the first module. The cloned operations retained types and attributes owned by the source context. When that context was destroyed, destruction of the merged module accessed freed MLIR objects and could terminate withSIGSEGVinmlir::Operation::~Operation().Fix
Reparse each source module text in the first module's target
Contextbefore cloning its operations. This keeps all operations, types, attributes, and dialect objects in the merged module under one Context lifetime.Validation
ptodsl/tests/test_ast_rewrite_example_ir.py: PASScheck-dsl: 29/29 passedcheck-pto: 1622 tests passed, 0 failurespure virtual method calledon the merged AST softmax case