Support compute_dtype in HowToQuantize in QWIX - #379
Open
copybara-service[bot] wants to merge 1 commit into
Open
copybara-service[bot] wants to merge 1 commit into
copybara-service[bot] wants to merge 1 commit into
Conversation
Decouples the logical quantization format (qtype) from the physical compute/storage representation (compute_dtype). Rationale and use cases: - Preserve experimental accumulation precision: Allows simulation and ablation studies to explicitly control the matrix multiplication accumulation path (e.g. evaluating hardware FP8 accumulation versus BF16/FP32 dequantization) independently of the quantization discretization grid. - Hardware acceleration for sub-byte and integer formats: Accelerates INT4 and FP4 inputs on hardware with native FP8 matrix multiplication units (e.g. TPU v6e / Ghostfish and modern GPUs). Because all 16 values of INT4 ([-8, 7]) and all 15 finite values of FP4 (E2M1) are exact representable values in float8_e4m3fn (zero numerical precision loss), setting compute_dtype=jnp.float8_e4m3fn allows INT4, FP4, and multi-pass INT4 (emulating INT8) to flow directly through native hardware FP8 GEMM units without requiring specialized sub-byte hardware kernels. Changes: - Add compute_dtype field to HowToQuantize and quantize_api. - In quantize_with_scale_zero_point, cast qvalue (and zero_point if present) to compute_dtype after discretization while preserving the logical qtype on QArray. - Add unit test in qarray_test verifying logical qtype preservation and compute_dtype casting. PiperOrigin-RevId: 982823397
copybara-service
Bot
force-pushed
the
test_982823397
branch
from
September 17, 2026 17:09
4562915 to
11a38fa
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Support compute_dtype in HowToQuantize in QWIX
Decouples the logical quantization format (qtype) from the physical compute/storage representation (compute_dtype).
Rationale and use cases:
Changes: