Skip to content

FLUX.3 fp32 calibrated test: allow the guard re-read from #17949 (diffusion red on main) - #17974

Merged
danielhanchen merged 1 commit into
mainfrom
fix-flux3-scaled-table-reader-test
Nov 16, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
fix-flux3-scaled-table-reader-test

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Summary

(Python 3.13, diffusion) is red on main (seen on the staging runs of #17966 and #17971):

studio/backend/tests/test_diffusion_flux3_fp32_calibrated.py::test_only_the_load_plan_reads_the_scaled_table
E   assert 2 == 1

The test pinned that the scaled (float32) activation row, _calibrated_activation(..., fp32_scaled = True), is read in exactly one place in DiffusionBackend: the load plan. #17949 (FLUX.3 Klein on T4) added a second read in the generation guard:

guard_measured = placement_measured_activation(state.pipe)
if guard_measured is None and getattr(state, "calibrated_placement", False):
    guard_measured = _calibrated_activation(fam, guard_target, fp32_scaled = True)

That read re-uses the same row the calibrated placement was sized from, so the guard and the plan agree. It is intended, and it keeps what the test protects (an uncalibrated or post-load reader never sees the scaled row). The string count was just too blunt.

Change

Test only, test_only_the_load_plan_reads_the_scaled_table, now walks the AST instead of counting a substring:

  • exactly two fp32_scaled=True reads in DiffusionBackend;
  • one is the load plan's calibrated_activation= argument (still pinned verbatim);
  • the other must sit under an if whose test checks calibrated_placement.

Testing

  • test_diffusion_flux3_fp32_calibrated.py: 10 passed. On main the test fails as above.
  • Sabotage: dropping the calibrated_placement condition from the guard fails it; adding a third scaled read fails it.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 16, 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-16T12:13:54.846514Z 2ffe406 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. Chef's kiss.

Reviewed commit: 2ffe406e49

ℹ️ 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 c858a98 into main Nov 16, 2026
@danielhanchen
danielhanchen deleted the fix-flux3-scaled-table-reader-test branch November 16, 2026 12:16
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