Skip to content

Fix red arg to subst#1016

Merged
inducer merged 5 commits into
mainfrom
fix-red-arg-to-subst
Jun 3, 2026
Merged

Fix red arg to subst#1016
inducer merged 5 commits into
mainfrom
fix-red-arg-to-subst

Conversation

@inducer

@inducer inducer commented Jun 3, 2026

Copy link
Copy Markdown
Owner

@majosm This became much bigger than I had hoped. I'd like it if you could take a quick look at the changes in reduction_arg_to_subst_rule.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors reduction_arg_to_subst_rule to use Loopy’s rule-aware mapping machinery (with stack matching via within) so that reduction arguments can be rewritten more robustly, alongside a broader set of typing/documentation cleanups (notably around instruction IDs and barrier/no-sync kinds).

Changes:

  • Reworked reduction_arg_to_subst_rule to use a RuleAwareIdentityMapper-based mapper with within stack matching.
  • Introduced/propagated stronger typing for instruction IDs (InsnId), barrier kinds (BarrierKind), and no-sync scopes (NoSyncScope) across transforms/scheduling/instruction definitions.
  • Updated Sphinx documentation/config to reference the new type aliases.

Reviewed changes

Copilot reviewed 11 out of 12 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
loopy/typing.py Adds InsnId to the public typing docs.
loopy/transform/data.py Refactors reduction_arg_to_subst_rule to rule-aware mapping + adds typing.
loopy/transform/add_barrier.py Tightens typing of barrier kind arguments using BarrierKind.
loopy/symbolic.py Fixes reduction callback typing to use Reduction instead of Expression.
loopy/schedule/__init__.py Propagates barrier/no-sync typing and adds more explicit type annotations.
loopy/kernel/instruction.py Introduces NoSyncScope, BarrierKind, and to_barrier_kind; tightens no_sync_with typing.
loopy/kernel/creation.py Uses to_barrier_kind when creating barrier instructions from textual syntax.
loopy/kernel/array.py Narrows ArrayBase.offset type annotation (currently inconsistent with runtime behavior).
loopy/kernel/__init__.py Tightens typing for no-sync scope queries and adds type annotations.
doc/ref_kernel.rst Attempts to document new type aliases (currently using autoclass).
doc/conf.py Adds missing-reference aliases for the new type aliases.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread loopy/transform/data.py Outdated
Comment thread loopy/kernel/array.py
Comment thread doc/ref_kernel.rst
Comment thread doc/ref_kernel.rst
@inducer inducer force-pushed the fix-red-arg-to-subst branch from b83ddf3 to 3400269 Compare June 3, 2026 21:00
@inducer inducer enabled auto-merge (rebase) June 3, 2026 21:00
@inducer inducer force-pushed the fix-red-arg-to-subst branch from 3400269 to e39e493 Compare June 3, 2026 21:55
@inducer

inducer commented Jun 3, 2026

Copy link
Copy Markdown
Owner Author

All better now. This was badly broken previously.

@inducer inducer merged commit 682ad32 into main Jun 3, 2026
17 checks passed
@inducer inducer deleted the fix-red-arg-to-subst branch June 3, 2026 22:31
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