Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.
TypeScript ai-artartificial-intelligencegenerative-artimage-generationimg2imginpaintinglatent-diffusionlinuxmacosoutpaintingstable-diffusiontxt2imgwindows
test(quantization): size the two unreserved MX terms against each other
Alexander Eichhorn8d8566d246c8
diff --git a/tests/backend/model_manager/load/test_krea2_mxfp8_keys.py b/tests/backend/model_manager/load/test_krea2_mxfp8_keys.pyindex 1212ece107..9fb768039b 100644--- a/tests/backend/model_manager/load/test_krea2_mxfp8_keys.py+++ b/tests/backend/model_manager/load/test_krea2_mxfp8_keys.py@@ -73,6 +73,10 @@ def test_the_block_width_the_builder_uses_is_the_one_the_released_build_stores()tested against itself, so the width is read out of the capture here and our constant is checkedagainst it -- 40 real layers, five distinct geometries.+ The second half pins something separable: `mxfp8_tensors`' default `block_size` is a parameter that+ can be edited away from `MX_BLOCK_SIZE`, and then every synthetic grid would be built at a width+ the file does not use while the first assertion still passed.+Deliberately not repeated here: that a distinct grid survives the de-swizzle. A constant grid isinvariant under every permutation, so it cannot see a tile error at all; that is`TestMxfp8.test_the_exponents_are_decoded_and_unswizzled`, which uses varying exponents.@@ -81,6 +85,9 @@ def test_the_block_width_the_builder_uses_is_the_one_the_released_build_stores()for path in QUANTIZED:(_rows, columns), _dtype = KEYS[f"{path}.weight"](_scale_rows, blocks), _scale_dtype = KEYS[f"{path}.weight_scale"]+ # Exact rather than floor division, which would let a remainder through: 6145 columns over+ # 192 blocks still floors to 32.+ assert columns % blocks == 0, pathwidths.add(columns // blocks)assert widths == {MX_BLOCK_SIZE}@@ -88,4 +95,4 @@ def test_the_block_width_the_builder_uses_is_the_one_the_released_build_stores()tensors, _expected = mxfp8_tensors("lin", torch.full((128, 4), 127))weight, scale = tensors["lin.weight"], tensors["lin.weight_scale"]- assert weight.shape[1] // scale.shape[1] == widths.pop()+ assert weight.shape[1] // scale.shape[1] == MX_BLOCK_SIZEdiff --git a/tests/backend/quantization/test_fp8_scaled.py b/tests/backend/quantization/test_fp8_scaled.pyindex 25e4d3f9fc..15c65008ca 100644--- a/tests/backend/quantization/test_fp8_scaled.py+++ b/tests/backend/quantization/test_fp8_scaled.py@@ -1551,10 +1551,13 @@ class TestReservationCoversTheSideChannelItHolds:once, which is why it is what this class pins: one entry per 32 weight elements, so around 1.5 GBon Comfy-Org's 12 GB MXFP8 build.- The larger term is transient and bounded differently. `dequantize_fp8_scaled` folds one layer at a- time, and for a block-wise grid `expand_weight_scale` `repeat_interleave`s it to the weight's full- width in float32 -- 4 B/element -- beside `weight.float()` and the float32 product, so the peak is- ~14 B/element of the *largest* layer against 2 predicted. `int8_convrot.py:607` records the policy+ The per-layer term is larger *per element* and not in absolute peak. `dequantize_fp8_scaled` folds+ one layer at a time, and for a block-wise grid `expand_weight_scale` `repeat_interleave`s it to the+ weight's full width in float32 -- 4 B/element -- beside `weight.float()` and the float32 product,+ so the peak is ~14 B/element of the *largest* layer against 2 predicted. Measured on the released+ 12.6 GiB build: its largest quantized layers are 16384x6144, so ~1.21 GB for one of them, against+ 1.455 GiB of grids summed over all 256. The grids are the bigger number as well as the persistent+ one, which is why they are what this class pins. `int8_convrot.py:607` records the policythat absorbs such a transient in the reservation's slack, on the grounds that "the widened set isby construction the small one". That justification does not transfer here: a block-wise scale isnever matmul-usable (`is_matmul_usable_scale`), so for MXFP8 the widened set is every quantized