Skip to content

[REFACTOR][IR] Generalize staging lambdas and explicit thread reductions - #20552

Merged
tqchen merged 7 commits into
apache:mainfrom
tqchen:ir/staging-lambda-allreduce
Oct 6, 2026
Merged

tqchen merged 7 commits into
apache:mainfrom
tqchen:ir/staging-lambda-allreduce

Conversation

@tqchen

@tqchen tqchen commented Oct 5, 2026 •

Copy link
Copy Markdown
Member

Move typed staging lambdas into shared IR with Expr bodies, parameter substitution through one structural map, function signatures derived at construction, and TVMScript Lambda construction using ordinary Python callable binding.

Represent thread reductions with explicit combiner, identity, value, predicate, destination, and axis operands. Preserve scalar or Tuple operands and combiner results through reduction lowering and datatype legalization, and remove reduce_scope transport.

@tqchen
tqchen force-pushed the ir/staging-lambda-allreduce branch from 45bca85 to 98305c0 Compare October 5, 2026 21:03
tqchen added 6 commits October 6, 2026 01:56
Move typed staging lambdas into shared IR with Expr bodies, capture-safe application, derived function signatures, and typed script construction.

Represent thread reductions with explicit combiner, identity, value, predicate, destination, and axis operands. Update reduction lowering and datatype legalization to consume that contract and remove reduce_scope transport.
Keep lambda implementation with the shared expression nodes and use structural mutation for scoped substitution. Preserve generic tuple mutation behavior and let datatype legalization apply the combining lambda directly.

Consolidate basic lambda usage and retain the ordinary all-reduce signature without a separate operand validator.
Apply staging lambdas through one structural map of parameter references. Derive function signatures at construction and use reflected traversal for ordinary rewrites.
Accept scalar or Tuple reduction operands and combiner results throughout lowering and datatype legalization. Construct lambda parameters from the supplied types and use ordinary callable binding. Apply promoted variables directly and infer promoted primitive result types.
Use one Lambda constructor spelling across shared and TIR script exports, printing, and callers. Keep reduction operand fields distinct from the hardware-axis map used by region-based thread launches.
@tqchen
tqchen force-pushed the ir/staging-lambda-allreduce branch from a5cb470 to 7d79464 Compare October 6, 2026 02:09
Use the common tile-select predicate check for callable and prebuilt lambdas instead of repeating the boolean return check during callable construction.
@tqchen
tqchen merged commit d08e468 into apache:main Oct 6, 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.

2 participants