Skip to content

Export captured left-padded Metal attention - #11

Open
ronaldmannak wants to merge 2 commits into
claude/metal-sdpa-left-padding-skipfrom
codex/sdpa-left-padding-export
Open

ronaldmannak wants to merge 2 commits into
claude/metal-sdpa-left-padding-skipfrom
codex/sdpa-left-padding-export

Conversation

@ronaldmannak

Copy link
Copy Markdown
Owner

Stacked on #8.

A captured, unevaluated Metal attention graph using left_padding currently fails to export because the graph contains a Contiguous operation. Move layout preparation to Metal SDPA using the existing input-copy helper. Give padded attention a distinct serialized name so import restores the padding mode and existing SDPA records retain their layout. Importing a captured padded-attention record requires a Metal GPU.

The first commit fixes a separate issue exposed by the round trip. Exported constants have no stored strides, so an evaluated strided view must be packed in row-major order before its bytes are written. Each commit adds a regression test.

On M5 Max, the full Python suite passed 992 tests with 57 skips. Twelve direct and twelve captured export cases round-tripped bit for bit. The separate checks for a legacy masked-attention record and evaluated strided padding counts also passed. The prototype matched #8 bit for bit across 23 attention benchmark cases, with a median latency change of +0.1%. A CPU-tagged padded-attention record was rejected with an explicit error.

Codex implemented and tested this fork PR.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-15T06:31:39.821233Z c1ed631 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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