Skip to content

Tests: price the auto-context fit floor as the layer-split path on any host - #16014

Merged
danielhanchen merged 1 commit into
mainfrom
tests-auto-context-floor-off-metal
Oct 29, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
tests-auto-context-floor-off-metal

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Summary

Five tests in studio/backend/tests/test_memory_estimate.py::TestAnAutoContextIsMarkedShrinkable fail on any Apple Silicon host. The regular CI does not run this file on macOS, so they surface when a PR touching memory estimation gets a macOS leg (the staging xplat run for #15970 on macos-26; that PR changes only the MLX estimate):

test_an_unnamed_context_is_priced_at_the_fit_floor[request_fields0-True-8192]
    assert shorter.gpu_bytes < resp.gpu_floor_bytes == floor.gpu_bytes < resp.gpu_bytes
E   assert 18402857 < 18402857
test_tensor_mode_takes_the_layer_fallback_floor[None]
E   assert 1102368297 == 1264897577

Since #12555, _estimate_context_floor uses _FIT_FLOOR_MIN_CTX (256) on Apple Silicon, where Metal reprices down to the smallest context it searches, and _FIT_MIN_CTX (8192) for a layer split elsewhere. TestTheContextFloorFollowsThePlacementPath pins both paths explicitly; this class assumes the layer-split one but reads the real host, so on a Mac its auto-mode floor is the 256 context it compares against. The product is right; the class never said which host it prices.

Reproduced on main on Linux with is_apple_silicon() forced to True (the macOS runner's answer): the same 5 fail.

What changed

The class's autouse fixture pins utils.hardware.is_apple_silicon to False, with a comment pointing at the class that covers Metal.

Verification

  • Main with is_apple_silicon() forced True: 5 failed in this class.
  • Head, same forcing: this class and TestTheContextFloorFollowsThePlacementPath 39 passed.
  • Head on Linux: tests/test_memory_estimate.py 283 passed, 98 skipped.
  • With _FIT_MIN_CTX changed from 8192 to 4096, 7 tests in this class fail, so it still pins the layer-split floor.

…y host, so a Mac runner does not take Metal's
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-29T17:25:18.088704Z 948c7f2 Manual request
ℹ️ 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.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

Reviewed commit: 948c7f2a6f

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danielhanchen
danielhanchen merged commit 8ecab3d into main Oct 29, 2026
0 of 35 checks passed
@danielhanchen
danielhanchen deleted the tests-auto-context-floor-off-metal branch October 29, 2026 17:39
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