Skip to content

[CI] Re-enable macOS M2 trunk mps and perf nightly, add macos-m2-27 MPS coverage - #201517

Closed
huydhn wants to merge 2 commits into
pytorch:mainfrom
huydhn:mac-m2-reenable
Closed

huydhn wants to merge 2 commits into
pytorch:mainfrom
huydhn:mac-m2-reenable

Conversation

@huydhn

@huydhn huydhn commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up to #201231. The mac2-m2pro.metal fleet shift in pytorch/test-infra#8964 is deployed:

  • macos-m2-26 (macOS 26) has 28 runners, up from 8
  • macos-m2-27 (macOS 27) has 8 runners

This undoes the temporary pause from #201231 and adds macOS 27 coverage:

  • trunk.yml: re-add the mps shard on macos-m2-26
  • inductor-perf-test-nightly-macos.yml: restore the nightly schedule (0 7 * * *)
  • mac-mps.yml: add test_mps on macos-m2-27, so MPS runs on macos-m1-15, macos-m2-26 and macos-m2-27 (macOS 15 / 26 / 27)
  • actionlint.yaml and the pr-review runner-naming list: add macos-m2-27

As of 2026-10-20 04:00 UTC, all 28 macos-m2-26 and 8 macos-m2-27 runners are registered and online.

macOS 27.0.0 fix. The new macos-m2-27 job surfaced a real bug: test_mm_stride_zero failed on the macOS 27.0.0 runners, with 960/1024 elements wrong. That's the #180201 symptom, where MPSGraph matmul with stride-0 inputs computes only every 16th row. Apple fixed it in 26.4, but it's back in 27.0.0, and 27.0.1 and 27.2 are fine (thanks @Isalia20). mm only applied the contiguify workaround on macOS < 26.4. This PR adds a patch-level MacOSVersion::MACOS_27_0_1 and widens the gate to < 26.4 || 27.0.0. Behaviour on every other macOS version is unchanged, and only mm with non-complex stride-0 inputs is affected.

…PS coverage

The mac2-m2pro fleet shift (pytorch/test-infra#8964) is deployed: macos-m2-26 now has
28 runners and macos-m2-27 (macOS 27) has 8. Undo the temporary pause from pytorch#201231:

- trunk.yml: re-add the mps shard on macos-m2-26
- inductor-perf-test-nightly-macos.yml: restore the nightly schedule
- mac-mps.yml: add test_mps on macos-m2-27 (macOS 15 / 26 / 27 coverage)
- actionlint.yaml / pr-review runner list: add macos-m2-27
@pytorch-bot

pytorch-bot Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

PR Status: in progress

A maintainer requested changes. Please address their feedback before the PR returns to maintainer review.

To become ready for review, the change must pass automated review and every maintainer comment must be addressed, either with a code change or a reply explaining why no change is needed. A fresh automated review checks that the feedback has been addressed. All CI must finish and Dr. CI must classify every failure as unrelated to your PR. Fix the failures it attributes to your PR (see status below in this comment). Workflows waiting for a maintainer to approve their run do not block this.

To minimize iteration time, feel free to run the pr-review skill from the repo locally. If you address comments without pushing, comment @pytorchbot review to re-run the automated review. To bypass automated review, please add the “no automated review” label.

🟡 AUTOMATED REVIEW - Changes requested:

The PR turns the macOS M2 trunk `mps` shard and the perf nightly back on, adds a
`test_mps` job on `macos-m2-27`, and widens the `mm` stride-0 contiguify
workaround (# 180201) to cover macOS 27.0.0. Recommendation: Request Changes.
Two things block it: @​ Isalia20's comment hasn't been answered, and the new
`macos-m2-27` runner label doesn't follow the runner naming standard.

Findings (4):

[major] aten/src/ATen/native/mps/operations/LinearAlgebra.mm:1193
Unaddressed maintainer comment (@​ Isalia20). @​ Isalia20 suggested dropping the
macOS version gate entirely and applying the stride-0 workaround on every macOS
version, since MPSGraph has now brought this bug back once. The PR keeps a
version gate and makes it finer, adding a patch-level `MACOS_27_0_1` cutoff.
Neither the author nor @​ malfet has replied. Any later release that brings the
bug back would again give silently wrong `mm` results until someone finds it.
Either make the change @​ Isalia20 asked for (set `has_stride_zero_mm_bug`
unconditionally), or reply in the thread and explain why t

[major] .github/workflows/mac-mps.yml:37
Blocker: the new runner label `macos-m2-27` breaks the naming standard. It has
no provider, and it doesn't use the `{os}`, `{arch}{vendor}`, `{vcpu}` or
`{memory}` fields. It doesn't match
`^(c-)?(mt|lf|am|in|nv|ib)-(rel-)?[lwm]-b?(x86|arm64g[234])-$`. No other CI in
this repo uses it; the only other hits are this PR's added lines and the
`.github/actionlint.yaml` allowlist, which doesn't count. The standard can't
express Apple Silicon, so you can't fix this by picking a better name. The
canonical `runner_naming_convention.md` in pytorch/ci-infra has to be extended
first, and the runner de

[minor] aten/src/ATen/native/mps/operations/LinearAlgebra.mm:1190
The gate's comment overstates what was tested. It says "26.4+ and 27.0.1+ are
fine", but the PR description says only 27.0.1 and 27.2 were checked; 27.1
wasn't. If the gate stays, fix the comment to list only the versions that were
actually verified.

[minor] .github/workflows/trunk.yml:259
Heads-up (non-blocking): `macos-m2-26` also breaks the runner naming standard.
The re-added `mps` row has the same field problems as `macos-m2-27`. Other CI
already uses the label (`mac-mps.yml:36` and
`inductor-perf-test-nightly-macos.yml:54-59`), so it doesn't block this PR.

Reviewed commit: 43f9636

Review run

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/201517

Note: Links to docs will display an error until the docs builds have been completed.

✅ No Failures

As of commit 43f9636 with merge base f21bd8f (image):
💚 Looks good so far! There are no failures yet. 💚

🟡 GREEN LIGHT - OUTDATED (earlier commit) - PR requires human review:

  • New trunk test job
    • .github/workflows/trunk.yml adds config: "mps" on macos-m2-26 to a test-matrix that before held only default and openreg
    • A config: new to a trunk.yml matrix is a new job gating viable/strict; whether it earns that cost is a human call
  • Capacity-dependent re-enablement
    • Restoring the nightly schedule in inductor-perf-test-nightly-macos.yml and adding macos-m2-27 in mac-mps.yml rely on fleet sizes the PR body asserts but the diff cannot show
  • Reviewer steering
    • The diff also edits .agents/skills/pr-review/ci-runner-naming.md, an AI review skill's label list, which deserves a human glance

reason: not_trivial
Reviewed commit: d3d6f57 (NOT the current head 43f9636)

Inference job

🐛 Report a wrong verdict

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@pytorch-bot pytorch-bot Bot added the topic: not user facing topic category label Oct 20, 2026
@huydhn huydhn added the ciflow/mps Run MPS tests (subset of trunk) label Oct 20, 2026
@huydhn
huydhn marked this pull request as ready for review October 20, 2026 04:31
@huydhn
huydhn requested a review from a team as a code owner October 20, 2026 04:31
@huydhn
huydhn requested a review from malfet October 20, 2026 04:32
@pytorchbot pytorchbot added the in progress PR is being worked on by the author, until the automated review accepts it label Oct 20, 2026
github-actions[bot]

This comment was marked as outdated.

@Isalia20

Copy link
Copy Markdown
Collaborator

oh wow, MPS Graph reintroduced a bug in 27.0 for matmuls 🫠

@Isalia20

Copy link
Copy Markdown
Collaborator

Works on 27.0.1 and 27.2 though, @malfet I think we should just stop gating the workaround on macOS for this case and do that workaround across all macOSes.

@huydhn huydhn added the keep-going Don't stop on first failure, keep running tests until the end label Oct 20, 2026
MPSGraph matrixMultiplication with stride-0 inputs (only every 16th row computed,
pytorch#180201) is fixed in macOS 26.4 but regressed in macOS 27.0.0; 27.0.1 and later are
fine. mm only applied the contiguify workaround on macOS < 26.4, so on 27.0.0
test_mm_stride_zero failed (960/1024 elements wrong) on the new macos-m2-27 runners.

Add a patch-level MacOSVersion::MACOS_27_0_1 and widen the gate to
'< 26.4 || 27.0.0'. Behaviour is unchanged on every other macOS version, and only
mm with non-complex stride-0 inputs takes the gather/clone path.
@huydhn
huydhn requested a review from Isalia20 as a code owner October 20, 2026 17:10

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Automated review of 43f9636: changes requested before human review.

The PR turns the macOS M2 trunk mps shard and the perf nightly back on, adds a test_mps job on macos-m2-27, and widens the mm stride-0 contiguify workaround (# 180201) to cover macOS 27.0.0. Recommendation: Request Changes. Two things block it: @ Isalia20's comment hasn't been answered, and the new macos-m2-27 runner label doesn't follow the runner naming standard.

🔴 2 blocking findings are attached to the code below.

⚪ 2 non-blocking findings

// 26.4+ and 27.0.1+ are fine. On affected versions, contiguify such tensors by disabling

The gate's comment overstates what was tested. It says "26.4+ and 27.0.1+ are fine", but the PR description says only 27.0.1 and 27.2 were checked; 27.1 wasn't. If the gate stays, fix the comment to list only the versions that were actually verified.


{ config: "mps", shard: 1, num_shards: 1, runner: "macos-m2-26" },

Heads-up (non-blocking): macos-m2-26 also breaks the runner naming standard. The re-added mps row has the same field problems as macos-m2-27. Other CI already uses the label (mac-mps.yml:36 and inductor-perf-test-nightly-macos.yml:54-59), so it doesn't block this PR.

Please address the findings and push; a new commit normally gets a fresh automated review.

This review is AI-generated and advisory. Each new automated review replaces the previous one.

// the strided API so they go through the gather/clone path first.
// See https://github.com/pytorch/pytorch/issues/180201
static const bool is_macOS_26_4_or_newer = is_macos_at_least(MacOSVersion::MACOS_26_4);
static const bool has_stride_zero_mm_bug = !is_macos_at_least(MacOSVersion::MACOS_26_4) ||

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔴 Unaddressed maintainer comment (@ Isalia20). @ Isalia20 suggested dropping the macOS version gate entirely and applying the stride-0 workaround on every macOS version, since MPSGraph has now brought this bug back once. The PR keeps a version gate and makes it finer, adding a patch-level MACOS_27_0_1 cutoff. Neither the author nor @ malfet has replied. Any later release that brings the bug back would again give silently wrong mm results until someone finds it. Either make the change @ Isalia20 asked for (set has_stride_zero_mm_bug unconditionally), or reply in the thread and explain why t

{ include: [
{ config: "test_mps", shard: 1, num_shards: 1, runner: "macos-m1-15" },
{ config: "test_mps", shard: 1, num_shards: 1, runner: "macos-m2-26" },
{ config: "test_mps", shard: 1, num_shards: 1, runner: "macos-m2-27" },

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔴 Blocker: the new runner label macos-m2-27 breaks the naming standard. It has no provider, and it doesn't use the {os}, {arch}{vendor}, {vcpu} or {memory} fields. It doesn't match ^(c-)?(mt|lf|am|in|nv|ib)-(rel-)?\[lwm\]-b?(x86|arm64g\[234\])-$. No other CI in this repo uses it; the only other hits are this PR's added lines and the .github/actionlint.yaml allowlist, which doesn't count. The standard can't express Apple Silicon, so you can't fix this by picking a better name. The canonical runner_naming_convention.md in pytorch/ci-infra has to be extended first, and the runner de

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is non-sense. Let me take an action to fix this

@huydhn

huydhn commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor Author

Works on 27.0.1 and 27.2 though, @malfet I think we should just stop gating the workaround on macOS for this case and do that workaround across all macOSes.

@Isalia20 Pls take a look, I have gated this on 27.0.0 accordingly. I'm aiming for a minimal surgical gate only for 27.0.0 here, let me know if you have a different approach in mind.

@huydhn

huydhn commented Oct 20, 2026

Copy link
Copy Markdown
Contributor Author

@pytorchbot merge -f 'MPS jobs have passed'

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Merge started

Your change will be merged immediately since you used the force (-f) flag, bypassing any CI checks (ETA: 1-5 minutes). Please use -f as last resort and instead consider -i/--ignore-current to continue the merge ignoring current failures. This will allow currently pending tests to finish and report signal before the merge.

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

huydhn added a commit to huydhn/pytorch that referenced this pull request Oct 20, 2026
…naming check

The self-hosted macOS fleets are EC2 Mac pet instances, not OSDC, and the naming
standard cannot express Apple Silicon, so every new macOS label (e.g. macos-m2-27
on pytorch#201517) was an unfixable blocker. Keep them in scope, but define their own
form, matching what the runner install playbook derives on each Mac:
macos-<chip>-<macOS major> plus a per-chip -stable alias,
^macos-m[1-9][0-9]*-([1-9][0-9]|stable)$. New chips and macOS releases
(macos-m2-27, macos-m4-27) pass with no further edits; malformed macOS labels
are still flagged.
huydhn added a commit to huydhn/pytorch that referenced this pull request Oct 20, 2026
…runner naming check

The self-hosted macOS fleets are not on OSDC yet and keep their legacy labels
until they migrate, so flagging every new one (e.g. macos-m2-27 on pytorch#201517) as a
blocker was wrong. Keep them in scope, but accept their legacy form, matching
what the runner install playbook derives on each Mac: macos-<chip>-<macOS major>
plus a per-chip -stable alias, ^macos-m[1-9][0-9]*-([1-9][0-9]|stable)$.
New chips and macOS releases pass with no further edits; malformed macOS labels
are still flagged.

Also drop Apple Silicon from 'Hardware the Standard Cannot Express': the
canonical naming doc has os=m for macOS, and the macOS labels are legacy, not
inexpressible.
huydhn added a commit to huydhn/pytorch that referenced this pull request Oct 20, 2026
…naming check

The self-hosted macOS fleets are not OSDC runners and use their own label
convention, so flagging every new one (e.g. macos-m2-27 on pytorch#201517) as a blocker
was wrong. Keep them in scope, but accept their form, matching what the runner
install playbook derives on each Mac: macos-<chip>-<macOS major> plus a per-chip
-stable alias, ^macos-m[1-9][0-9]*-([1-9][0-9]|stable)$. New chips and macOS
releases pass with no further edits; malformed macOS labels are still flagged.

Also drop Apple Silicon from 'Hardware the Standard Cannot Express': the
canonical naming doc already has os=m for macOS.
huydhn added a commit to huydhn/pytorch that referenced this pull request Oct 21, 2026
…naming check

The self-hosted macOS fleets are not OSDC runners and use their own label
convention, so flagging every new one (e.g. macos-m2-27 on pytorch#201517) as a blocker
was wrong. Keep them in scope, but accept their form, matching what the runner
install playbook derives on each Mac: macos-<chip>-<macOS major> plus a per-chip
-stable alias, ^macos-m[1-9][0-9]*-([1-9][0-9]|stable)$. New chips and macOS
releases pass with no further edits; malformed macOS labels are still flagged.

Also drop Apple Silicon from 'Hardware the Standard Cannot Express': the
canonical naming doc already has os=m for macOS.
pytorchmergebot pushed a commit that referenced this pull request Oct 21, 2026
…201566)

✴️ iz2: The automated review cut inline findings off mid-sentence at 600 characters: `extract_verdict.py` caps each finding message there, and stage B was never told about the limit. 18 of the 32 most recent bot inline comments hit the cap. Example: #201517 (comment)

- `MAX_MESSAGE` goes from 600 to 1500, the same as `MAX_SUMMARY`.
- The stage B prompt asks for at most 1200 characters per finding message, counting each `&`, `<` and `>` as five, since escaping lengthens them.
- A message that still overflows ends in ` ...` at a word boundary. The input slice and the output cut both drop the token they split. `neutralize_message()` then drops trailing tokens until the result passes the publish check (`is_neutral_prose`). If no prefix passes, it returns empty, and the existing empty-message drop applies. A message that fails the check as a whole (for example, a blob that `neutralize()` joins) is not trimmed: it is still dropped as `failed_publish_check`.
- A contract test keeps the prompt's budget at or below 80% of `MAX_MESSAGE`, and tests cover the cut cases.

At the new cap, a review with 25 findings stays well under GitHub's body limit, and `MAX_BODY` still drops whole findings and says so when needed. Dr.CI's renderer has its own findings budget (`PR_REVIEW_FINDINGS_BUDGET`) and reports any findings it hides.

Test plan: `python3 -m unittest discover -s scripts/pr_review -p 'test_*.py'` (452 tests pass).
Pull Request resolved: #201566
Approved by: https://github.com/d4l3k
huydhn added a commit to huydhn/pytorch that referenced this pull request Oct 23, 2026
…naming check

The self-hosted macOS fleets are not OSDC runners and use their own label
convention, so flagging every new one (e.g. macos-m2-27 on pytorch#201517) as a blocker
was wrong. Keep them in scope, but accept their form, matching what the runner
install playbook in pytorch-gha-infra derives on each Mac:
macos-<chip>-<macOS major> plus a per-chip -stable alias,
^macos-m[1-9][0-9]*-([1-9][0-9]|stable)$. New chips and macOS releases pass
with no further edits; malformed macOS labels are still flagged.
huydhn added a commit to huydhn/pytorch that referenced this pull request Oct 23, 2026
…naming check

The self-hosted macOS fleets are not OSDC runners and use their own label
convention, so flagging every new one (e.g. macos-m2-27 on pytorch#201517) as a blocker
was wrong. Keep them in scope, but accept their form, matching what the runner
install playbook in pytorch-gha-infra derives on each Mac:
macos-<chip>-<macOS major> plus a per-chip -stable alias,
^macos-m[1-9][0-9]*-([1-9][0-9]|stable)$. New chips and macOS releases pass
with no further edits; malformed macOS labels are still flagged.
pytorchmergebot pushed a commit that referenced this pull request Oct 23, 2026
…naming check (#201579)

The pr-review runner naming check (`.agents/skills/pr-review/ci-runner-naming.md`, from #199315) flags every new self-hosted macOS label as a blocker. That's how `macos-m2-27` was flagged on #201517. But these runners aren't OSDC runners, and their `macos-m*` labels follow their own convention.

This PR keeps them in scope and accepts their form. It matches how the runner install playbook in pytorch-gha-infra builds the label on each Mac:

```
^macos-m[1-9][0-9]*-([1-9][0-9]|stable)$      # macos-<chip>-<macOS major>, plus a per-chip -stable alias
```

- New section "Self-Hosted macOS Labels" with the form
- "Checking a Label", step 3: validate `macos-m*` labels against that form, not the OSDC full form or length rule
- "What to Report": for a malformed `macos-m*` label, suggest a name in the macOS form (these runners are set up by pytorch-gha-infra, not ci-infra), and scope the Apple Silicon entry in "Hardware the Standard Cannot Express" to OSDC-form labels

New chips and macOS releases pass with no further edits, and malformed macOS labels are still flagged. Every `macos-m*` label in `.github` today (`macos-m1-15`, `macos-m1-stable`, `macos-m2-26`, `macos-m2-27`) matches.

The reviewer loads this file from `main`, so the change applies to reviews after it lands. No test changes are needed: `test_workflow_contract.py` pins which files are hashed, not what they contain.

Pull Request resolved: #201579
Approved by: https://github.com/izaitsevfb, https://github.com/jeanschmidt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/mps Run MPS tests (subset of trunk) in progress PR is being worked on by the author, until the automated review accepts it keep-going Don't stop on first failure, keep running tests until the end Merged topic: not user facing topic category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants