Skip to content

Move S-TIR specific node and TensorIntrin out of TIRX - #20378

Merged
tqchen merged 18 commits into
apache:mainfrom
tqchen:refactor-s-tir-node-ownership
Sep 17, 2026
Merged

tqchen merged 18 commits into
apache:mainfrom
tqchen:refactor-s-tir-node-ownership

Conversation

@tqchen

@tqchen tqchen commented Sep 17, 2026

Copy link
Copy Markdown
Member

Move SBlock, SBlockRealize, MatchBufferRegion and TensorIntrin into S-TIR ownership, including native definitions, reflection, Python APIs and serialized identities. Preserve shared TensorRegion compatibility for both typed and older object-form buffer-region graphs.

Reuse inherited traversal through explicit S-TIR analyzer, SSA, verification and simplification classes. Generic TIRX traversal uses structural definitions and remapping; storage alignment and schedulable dtype normalization stay in S-TIR. The shared statement simplifier and its configuration implementation belong to TIRX, retaining their existing runtime identities.

Adapt scheduling, TE, Relax and script consumers while preserving current script syntax and pipeline order. Define matched buffers before read/write regions, and limit private-function inlining to natively dispatchable TIRX roots. Type-preserving substitution remains structural before lowering; dtype-changing statement substitution targets core TIRX after block lowering.

Apply common variable, buffer and type well-formedness checks across parsed modules, then apply TIRX-specific execution checks to functions without the S-TIR attribute. This also checks ordinary TIRX functions in mixed modules; the legacy parse flag remains accepted without selecting verification. Separate script ownership remains a follow-up.

@tqchen
tqchen force-pushed the refactor-s-tir-node-ownership branch from a36d52f to d983615 Compare September 17, 2026 15:00
Own block, realization, and matching-region nodes in S-TIR, including reflection, structural callbacks, Python APIs, and serialized identities. Extend inherited traversal and dialect-aware helpers while retaining generic TIRX pass behavior and existing script syntax.
Use tensor_intrin names for the native declaration and registry implementation, with a dedicated Python class module that preserves the existing backend package and public TensorIntrin export.
Keep alignment annotations and their collector with the S-TIR compaction and lowering consumers. Visit block and allocation annotations directly without a TIRX registration bridge.
Replace dialect callback registries with inherited S-TIR analyzer, SSA, path verification and simplification paths. Keep generic structural traversal definition-aware and preserve generic specialization through buffer remapping.

Normalize schedulable TE and tensor intrinsic indices locally, keep ordinary dtype transforms after block lowering, and preserve scalar index temporaries when narrowing allocations.
Place StmtSimplifier and its configuration implementation in the tirx namespace and use that shared base from S-TIR. Keep arithmetic analyzer dependencies explicit and preserve existing runtime and pass configuration identities.
Visit match-buffer definitions before read/write regions, changing the former native read/write-before-match order to agree with structural definition-before-use traversal.

Generalize the private-function inline exclusion from SBlockRealize roots to every root absent from native TIRX statement dispatch. This also excludes future non-native roots whose binder and naming rules the inliner cannot preserve.
Centralize virtual-thread and asynchronous-wait keys in TIRX and retain S-TIR aliases so both schedulable and lowered consumers use the same protocol names.
Supply default region type and span metadata for the older two-field BufferRegion schema without shifting graph indices or replacing existing typed metadata.
Document dtype-changing statement substitution as a post-lowering TIRX operation while preserving structural type-preserving mappings. Share verifier fallback diagnostics, retain protected path-dispatch thunks, and make the normalizer hooks overridable without adding dialect collector or binding callbacks.
Keep the legacy parse dialect argument as documented compatibility syntax while internal callers rely on per-function attributes. Organize block-aware verification and simplification coverage under S-TIR while retaining core and mixed-dialect checks.
TRN tile implementations and initialization bodies capture buffers and indices from the scope where dispatch inserts them. Defer standalone well-formedness checks for these partial functions while retaining verification of complete parsed functions.
Represent scalar inputs as explicit parameters so intrinsic namespace roundtrips form complete functions under shared definition checks.
Follow the production lowering order when checking auto-copy padding and inspect the resulting core allocation shape.
Remove standalone coverage added for the ownership split and keep existing verification cases in their original suite with S-TIR entry points. Retain the existing API and lowering-phase adaptations.
@tqchen
tqchen force-pushed the refactor-s-tir-node-ownership branch from a4257b5 to 92328fe Compare September 17, 2026 17:12
@tqchen
tqchen merged commit d4d1ad2 into apache:main Sep 17, 2026
8 checks passed
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.

3 participants