Skip to content

fix: parametrized dtype silently overridden in test_autotuner, error message wrong in test_integration#4338

Open
tatavishnurao wants to merge 4 commits intopytorch:mainfrom
tatavishnurao:fix/test-autotuner-dtype-override
Open

fix: parametrized dtype silently overridden in test_autotuner, error message wrong in test_integration#4338
tatavishnurao wants to merge 4 commits intopytorch:mainfrom
tatavishnurao:fix/test-autotuner-dtype-override

Conversation

@tatavishnurao
Copy link
Copy Markdown

Summary

Two bugs found during test diagnostics:

1. Parametrized dtype silently overridden in test_autotuner.py

All three test methods in TestQuantFlow parametrize over dtype (both torch.bfloat16 and torch.float16), but immediately override it with dtype = torch.bfloat16:

  • test_int_mm (line 40)
  • test_int_mm_float8 (line 62)
  • test_int_scaled_mm (line 88)

This means the torch.float16 test cases never actually test float16 — they silently run with bfloat16 instead, giving false coverage.

Additionally, test_int_scaled_mm asserts out32_1.dtype == torch.bfloat16 which would fail for float16 if the override were removed. Fixed to assert the parametrized dtype instead.

Fix: Removed the three dtype = torch.bfloat16 overrides and changed the hardcoded assertion to use the parametrized dtype.

2. Incorrect variable in error message in test_integration.py

Line 641-642: The SQNR error message references SQNR(ref_f, ref_q) instead of SQNR(ref_f, test). When the assertion fails, the error message shows the SQNR between the float reference and the compiled quantized reference instead of the actual test value.

Fix: Changed ref_qtest in the error message.

Test plan

  • pytest test/kernel/test_autotuner.py — verify float16 parametrized tests now actually use float16
  • pytest test/integration/test_integration.py — verify no regressions

- Replace print() with logger.info() in fusion_utils.py (unconsoleable output during torch.compile)
- Add kernel availability guard to Int4OpaqueTensor.from_hp_da8w4() with clear error message
- Add kernel availability guard to QuantizedLinear._forward_2d() to prevent AttributeError
- Replace mutable default kwargs={} in _replace_embedding_with_quantized_embedding()
- Fix fragile stdout capture in test_rope_fusion_detection.py to use logger capture
- Add public API exports to embedding/__init__.py (EmbeddingQuantizer, QuantizedLinear, etc.)
- Remove unused _is_blackwell() from attention/utils.py
- Remove misconfigured @triton.autotune decorators (empty configs, constexpr key)
- Replace stale _float8_cutlass_quant imports with clear ImportError in
  benchmark_rowwise_scaled_linear_sparse_cutlass.py and
  benchmark_sparse_conversion_cutlass.py (AQT deletion removed these APIs)
- Replace stale torchao.prototype.uintx import with clear ImportError in
  benchmark_uintx.py (module no longer exists)
- Fix raise "string" TypeError in benchmark_hqq.py -> raise RuntimeError(...)
- Fix unclosed file handle in intmm.py (use with statement)
- Fix unused 'x' parameter in benchmark_gpu_sparsity.py
  benchmark_model_with_warmup() and remove misleading string arguments
- Fix output filename collision: benchmark_sparse_conversion_cutlass.py
  now writes to sparse_conversion_cutlass_time_results.csv
- Fix typo: deprecated_tenosr_subclass -> deprecated_tensor_subclass in
  benchmark_aq.py
…ntegration

- Remove  overrides in test_int_mm,
  test_int_mm_float8, and test_int_scaled_mm that silently overwrote
  the parametrized dtype value, making float16 test cases never actually
  test float16
- Fix assertion  to use the parametrized
  dtype instead
- Fix incorrect variable reference in test_integration.py SQNR error
  message:  →
@pytorch-bot
Copy link
Copy Markdown

pytorch-bot Bot commented Apr 26, 2026

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/ao/4338

Note: Links to docs will display an error until the docs builds have been completed.

❗ 1 Active SEVs

There are 1 currently active SEVs. If your PR is affected, please view them below:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Apr 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant