Skip to content

Take the least of three RssAnon peaks in the block dequant host RAM check test - #14561

Merged
danielhanchen merged 1 commit into
mainfrom
fix-block-dequant-peak-flake
Oct 21, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
fix-block-dequant-peak-flake

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

test_block_dequant_is_checked_for_its_peak_intermediates[nvfp4] (added in #14510) failed on #14558's Backend CI (Python 3.13, a-k) run (job 119452419222), on the same base where main's run passed it. #14558 only touches Laya files:

E   AssertionError: ([50298880], 56627200)
E   assert ([50298880] and 50298880 >= (0.9 * 56627200))

The test samples RssAnon while dequant_block runs and requires the host RAM charge to cover 90% of the growth. RssAnon is process-wide, so in a busy xdist worker anything else allocating at the same time is counted as the dequant's peak.

Run alone, the charge is close to exact. Charge / growth over 12 local runs each:

format min max
nvfp4 0.963 1.038
mxfp8 0.990 1.078

CI's 0.889 is about 6 MB of unrelated growth. The product's estimate is right; the measurement was noisy.

Change

The measurement runs three times, and the smallest growth is the one checked against the same 0.9 bar. Unrelated activity can only add to a reading, so the minimum is the closest to the dequant's own peak, and the guard keeps its strength.

Testing

  • Three back-to-back runs of both parameters: pass.
  • Sabotage: charging only the bf16 output, without the chunk intermediates, in diffusion_comfy_block.py fails both formats ([33554432] vs ~50 MB).

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 21, 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-21T21:08:54.861064Z 59762ec Manual request
🔒 Security Review ⚠️ Failed 2026-10-21T20:38:42.128649Z
We couldn’t complete this review. Comment @codex security review to try again.
59762ec 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.

@chatgpt-codex-connector

Copy link
Copy Markdown

The account paying for this security review has reached its Codex usage limits. The payer can check the Codex usage dashboard. For personal accounts, using credits requires enabling “Use credits for security reviews” in Code review settings. If you do not manage the paying account, contact this repository's admins.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 59762ec043

ℹ️ 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 94135ef into main Oct 21, 2026
@danielhanchen
danielhanchen deleted the fix-block-dequant-peak-flake branch October 21, 2026 21:11
danielhanchen added a commit that referenced this pull request Oct 21, 2026
Follow-up to #14561.
`test_block_dequant_is_checked_for_its_peak_intermediates[mxfp8]` failed
again on #14539's Backend CI `(Python 3.13, a-k)` run (job
119508973440). That base already had #14561's least-of-three readings:

```
E   AssertionError: ([50331648, 50331648, 50331648], 57405440)
E   assert ([50331648, 50331648, 50331648] and 50331648 >= (0.9 * 57405440))
```

The smallest of three readings was still about 7 MB above the charge, so
the extra memory is not a one-off spike. It is steady for the life of
that pytest worker. The product's estimate is not the problem: the same
torch (2.10.0+cpu, Python 3.13) measured alone gives charge / growth of
0.98 to 1.07 for both formats at 1, 2, 4 and 8 torch threads. A raised
glibc mmap or trim threshold does not reproduce it either. What differs
in CI is the worker's history: thousands of earlier tests, their threads
and their allocator state all count toward the process-wide `RssAnon`
this test reads.

## Change

The measurement runs in a fresh `python -c` subprocess: same tensors,
same sampler, same least of three, same 0.9 bar. The parent test only
checks the JSON the child prints. Nothing else lives in that process, so
the reading is the dequant's own.

## Testing

- Both parameters pass in three back-to-back runs. The whole
`test_diffusion_comfy_block.py` file passes: 55 passed, 5 skipped.
- Sabotage: charging only the bf16 output, dropping `chunk * per_row` in
`diffusion_comfy_block.py`, fails both formats (`[33554432] vs 47.9 MB /
51.1 MB`).

This failure did not reproduce locally, so the subprocess is aimed at
the one variable that differs from a clean run, rather than at a
confirmed allocator mechanism.
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