TileOPs-Metax/tests
ray24777 8fe17d8543 test(quant_swiglu): enforce bit-exact fp8 contract with torch
The test now compares both outputs with torch.equal (exact_compare),
matching the upstream TileKernels-Metax contract.  Three changes were
needed to reach bit-exactness:

- kernel: fix _pack_e4m3 subnormal branch.  The old
  ``reinterpret(round(v*512), u32) & 0x7`` masked the IEEE bits of a
  rounded float, so every subnormal encoded as +/-0, and ``& 0x7``
  truncated the 8 -> min-normal carry.  Now computes the RNE integer of
  |v|*512 (with ties-to-even correction for roundf's half-away) and
  preserves the carry.
- kernel: drop TL_ENABLE_FAST_MATH.  -use-fast-math approximates
  expf/division and shifts the bf16-rounded absmax by one bf16 quantum
  at rounding boundaries, breaking bit-exactness.  The reference
  TileKernels-Metax kernel also runs without it.
- test: the reference sf/sf_inv must use true IEEE division
  (tensor/tensor, not scalar) and the kernel's round_sf exponent bit
  trick ((bits + 0x007FFFFF) & 0x7F800000), not ceil(log2).

Perf cost of fast-math removal: ~28% on t8064-h4096-nt128 (0.25 -> 0.32
ms, 668 -> 523 GB/s).  Accepted: bit-exactness is the op's contract.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-05 11:35:44 +00:00
..
kernels docs: add MetaX C500 summer-camp guide on top of upstream dev 2026-07-28 17:55:09 +00:00
ops test(quant_swiglu): enforce bit-exact fp8 contract with torch 2026-08-05 11:35:44 +00:00
perf docs: add MetaX C500 summer-camp guide on top of upstream dev 2026-07-28 17:55:09 +00:00
trace [Feat][Trace] Add payload support and implicit thread blocks to trace API (#1661) 2026-07-07 21:31:03 +08:00
__init__.py [Refactor] Separate benchmark profiling from unit tests (#224) 2026-02-27 16:46:35 +08:00
compile_contract.py [Feat][OPS] compile dispatch boundary; pool declarations; design-doc audit (#1757) 2026-07-26 10:36:34 +08:00
conftest.py [Fix][CI] Isolate dynamo state in torch.compile tests (#1743) 2026-07-25 15:49:19 +08:00
nsa_utils.py [Refactor] Separate benchmark profiling from unit tests (#224) 2026-02-27 16:46:35 +08:00
test_base.py [Chore][Cleanup] repo slimming: dead code, duplicated tests/benches, compat shims, file defragmentation (#1764) 2026-07-26 12:59:48 +08:00
test_compile.py [Chore][Cleanup] repo slimming: dead code, duplicated tests/benches, compat shims, file defragmentation (#1764) 2026-07-26 12:59:48 +08:00
test_op_base.py [Test][TestInfra] consolidate root tests into validator-owned schema checks (#1756) 2026-07-26 08:59:13 +08:00
test_ops_manifest.py [Test][TestInfra] consolidate root tests into validator-owned schema checks (#1756) 2026-07-26 08:59:13 +08:00
test_reclaim_action.py [Chore][Cleanup] repo slimming: dead code, duplicated tests/benches, compat shims, file defragmentation (#1764) 2026-07-26 12:59:48 +08:00
test_roofline_codegen.py [Test][TestInfra] consolidate root tests into validator-owned schema checks (#1756) 2026-07-26 08:59:13 +08:00
test_tier_validation.py [Chore][Cleanup] repo slimming: dead code, duplicated tests/benches, compat shims, file defragmentation (#1764) 2026-07-26 12:59:48 +08:00
test_validate_manifest.py docs: add MetaX C500 summer-camp guide on top of upstream dev 2026-07-28 17:55:09 +00:00