Repository navigation
Measure the block dequant peak in a fresh process - #14579
Conversation
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
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. |
|
Codex Review: Didn't find any major issues. You're on a roll. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
… a fresh process (#15912) The `(Python 3.13, a-f)` shard on #15906's staging run failed one test the PR does not touch: ``` tests/test_diffusion_comfy_block.py:979: in test_int8_fp8_dequant_is_checked_for_its_float32_peak assert seen and max(seen) >= 0.9 * growth, (seen, growth) E AssertionError: ([201326592], 237703168) ``` The test passes on main and on #15906's head when run on its own. ## Cause This is the flake #14579 already fixed for `test_block_dequant_is_checked_for_its_peak_intermediates`. RssAnon is process-wide, and in a long-lived xdist worker it carries whatever earlier tests left behind. #14579 moved that test into a fresh process, with a `malloc_trim` baseline and the best of three. Two siblings in the same file kept measuring in the worker: `test_int8_fp8_dequant_is_checked_for_its_float32_peak` and the peak half of `test_swap_nibbles_is_bit_identical_and_checked_for_its_peak`. The CI reading shows how far off a worker reading can be. Measured on its own, the int8 ConvRot dequant grows by about two thirds of what it charges. The worker saw 237.7 MB against the 201.3 MB charge. ## Fix Both now run through the same kind of fresh-process probe as #14579 (`_HOST_PEAK_PROBE`, driven by `_host_peak_in_a_fresh_process`). The assertion is unchanged: the charge must cover at least 90% of the measured peak. The bit-identity half of the nibble-swap test still runs in process. `_rss_anon_now`, now unused, is removed. ## Verification Charge over measured growth in the fresh process, three runs each: | op | charge / growth | |---|---| | int8 ConvRot dequant | 1.50, 1.50, 1.50 | | fp8 dequant | 1.031, 1.035, 1.048 | | nibble swap | 1.179, 1.027, 1.097 | Each case stays above the 0.9 the test requires. - `test_diffusion_comfy_block.py`: 55 passed, 5 skipped (CUDA-only), serially and under `-n 8`. - Sabotage: undercharging `_dequant` (`codes.numel() * 4` instead of the float32 intermediates) fails both `float32_peak` cases in the fresh process.
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: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
RssAnonthis test reads.Change
The measurement runs in a fresh
python -csubprocess: 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
test_diffusion_comfy_block.pyfile passes: 55 passed, 5 skipped.chunk * per_rowindiffusion_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.