Skip to content

[Torch] Drop all-zero float zero points of PT2E ops - #25112

Merged
roberto-laudani merged 1 commit into
mainfrom
users/roberto-laudani/qdq-float-zero-points
Oct 23, 2026
Merged

roberto-laudani merged 1 commit into
mainfrom
users/roberto-laudani/qdq-float-zero-points

Conversation

@roberto-laudani

@roberto-laudani roberto-laudani commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

PT2E accepts float zero points, and exports store those of symmetric weights as float zeros. The conversion passed them to iree_linalg_ext.quantize_affine / dequantize_affine, which require integer zero points, so the converted IR failed verification:

'iree_linalg_ext.dequantize_affine' op expected zero_point to have a signless integer element type, got 'f32'
  • All-zero float zero points are now dropped like a None zero point.
  • The check reuses isKnownZero from [LinalgExt] Canonicalize zero zero-points in affine QDQ ops #24905, moved from LinalgExtOps.cpp to the LinalgExt utils and extended to float splats.
  • The per-channel, per-channel-group and per-token readers now read their zero points through one helper.

Part of #24862.

@roberto-laudani roberto-laudani self-assigned this Oct 23, 2026
@roberto-laudani
roberto-laudani force-pushed the users/roberto-laudani/qdq-float-zero-points branch from aeca16b to 6f04d67 Compare October 23, 2026 08:26
PT2E accepts float zero points, and exports store the zero points of
symmetric weights as float zeros. The conversion passed them to
`iree_linalg_ext.quantize_affine` / `dequantize_affine`, which require
integer zero points, so the converted IR failed verification. All-zero
float zero points are now dropped like a None zero point, and other
float zero points are left for the Torch-to-Linalg lowering. The check
reuses `isKnownZero` from the zero-point canonicalization, moved to the
LinalgExt utils and extended to float splats. The per-channel,
per-channel-group and per-token readers now read their zero points
through one helper.

Part of #24862.

Signed-off-by: Roberto Laudani <[email protected]>
@roberto-laudani
roberto-laudani force-pushed the users/roberto-laudani/qdq-float-zero-points branch from 6f04d67 to 8c0bce6 Compare October 23, 2026 08:34
@roberto-laudani roberto-laudani changed the title [Torch] Convert integral float zero points of PT2E ops [Torch] Drop all-zero float zero points of PT2E ops Oct 23, 2026
@roberto-laudani
roberto-laudani marked this pull request as ready for review October 23, 2026 08:38
roberto-laudani added a commit that referenced this pull request Oct 23, 2026
Converts the typed torchao `quantize_affine` / `dequantize_affine` ops
to `iree_linalg_ext.quantize_affine` / `dequantize_affine` during Torch
input conversion, reusing the PT2E conversion. Float zero points are
handled as for the PT2E ops.

Depends on #25112, llvm/torch-mlir#4843 and a torch-mlir integrate.

Part of #24862.

Signed-off-by: Roberto Laudani <[email protected]>
@roberto-laudani
roberto-laudani merged commit 87f4313 into main Oct 23, 2026
86 of 88 checks passed
@roberto-laudani
roberto-laudani deleted the users/roberto-laudani/qdq-float-zero-points branch October 23, 2026 10:05
@devtbi devtbi mentioned this pull request Nov 16, 2026
8 tasks done
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.

2 participants