Skip to content

[DRAFT] Use owned affine alignment API in the AD affine adjoints - #3116

Draft
wsmoses wants to merge 1 commit into
pb/carry-alignment-derivative-rulesfrom
pb/carry-alignment-affine-owned-draft
Draft

[DRAFT] Use owned affine alignment API in the AD affine adjoints#3116
wsmoses wants to merge 1 commit into
pb/carry-alignment-derivative-rulesfrom
pb/carry-alignment-affine-owned-draft

Conversation

@wsmoses

@wsmoses wsmoses commented Aug 9, 2026

Copy link
Copy Markdown
Member

Draft — blocked on the LLVM affine-alignment rebase. affine.load/affine.store do not carry an owned alignment in our pinned LLVM yet (the upstream affine-alignment interface is merged but not in our pin), so getAlignmentAttr()/setAlignmentAttr() on affine ops does not compile here. Stacked on #3115 (base is its branch), which lands the same carries today via the discardable "alignment" attribute; this PR migrates them to the proper API for when the rebase is ready.

Converts every affine alignment access in the AD affine adjoints (AffineAutoDiffOpInterfaceImpl.cpp) from the discardable attribute to the owned interface:

  • reads: op->getAttrOfType<IntegerAttr>("alignment")op.getAlignmentAttr()
  • writes onto a newly-built affine.load/store: op->setAttr("alignment", …)op.setAlignmentAttr(…)

The memref-target writes (the hasIndex sub-branches and the checkpointing cloneOp) are already on the owned API and are unchanged. Once affine ops own alignment, the discardable "alignment" round-trip (raising → LowerAlignedAffineAccesses) is no longer needed for these ops.

Retarget to main once #3115 merges; mark ready once the LLVM pin has affine alignment.

🤖 Generated with Claude Code

https://claude.ai/code/session_016zErYp7upmqr4NHfhod9UD

Blocked on rebasing to an LLVM where affine.load/store carry an owned
alignment (the upstream affine-alignment interface is merged but not yet in
our pinned LLVM); will not build until then. Stacked on #3115, which lands
the same carries today via the discardable "alignment" attribute.

Converts every affine alignment access in the AD affine adjoints from the
discardable attribute to the owned interface: reads become
affine op getAlignmentAttr(), writes onto a newly-built affine load/store
become setAlignmentAttr(). The memref-target writes are already on the owned
API and are unchanged. Once affine ops own alignment the discardable
"alignment" round-trip (raising -> LowerAlignedAffineAccesses) is no longer
needed for these ops.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016zErYp7upmqr4NHfhod9UD
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.

1 participant