Skip to content

tquant: sync 86 test cases with pto-isa + template infrastructure - #1206

Open
mediocrity-luo wants to merge 6 commits into
hw-native-sys:mainfrom
mediocrity-luo:tquant-only
Open

tquant: sync 86 test cases with pto-isa + template infrastructure#1206
mediocrity-luo wants to merge 6 commits into
hw-native-sys:mainfrom
mediocrity-luo:tquant-only

Conversation

@mediocrity-luo

Copy link
Copy Markdown
Contributor
  • lib/TileOps/a5/tquant.py: tquant templates (INT8_SYM/ASYM, MXFP8 ND/DN/Exp2D)
  • lib/TileOps/a5/tinsert.py: tinsert template
  • lib/TileOps/init.py: register tquant/tinsert templates
  • include/PTO/IR/PTOOps.td: tquant op definitions
  • lib/PTO/IR/VPTO.cpp: vbitcast sub-byte support (f4e2m1x2→ui8)
  • lib/PTO/IR/PTO.cpp: TQuantMxOp verifier (grp_axis/interleave/DN refactor)
  • lib/PTO/Transforms/ExpandTileOp.cpp: tquant operand attrs
  • lib/PTO/Transforms/InsertTemplateAttributes.cpp: tquant template attrs
  • lib/PTO/Transforms/PTOToEmitC.cpp: TQuantMxOp EmitC lowering
  • lib/PTO/Transforms/VPTO{CANN900,}LLVMEmitter.cpp: vcvt f16→bf16 support
  • tools/ptoas/ptoas.cpp: InsertTemplateAttributes pass in VPTO pipeline
  • ptodsl/ptodsl/_ops.py: tquant/tassign/tquant_mx/set_ctrl API + vcvt_contract
  • ptodsl/ptodsl/_tile_namespace.py: tile.quant namespace
  • ptodsl/ptodsl/pto.py: export set_ctrl, tassign
  • ptodsl/ptodsl/tilelib/serving/{client,daemon}.py: daemon error traceback
  • test/tilelib-st/a5/tquant/: 86 cases (INT8 6 + MXFP8 49 + MXFP4 25 + DN 6)
  • test/tilelib-st/a5/{tassign,tinsert_vec_to_mat}/: supporting tests
  • test/lit/pto/tquant_*.pto: lit tests
  • test/tilelib-st/common.py: bf16/assert_close enhancement

- lib/TileOps/a5/tquant.py: tquant templates (INT8_SYM/ASYM, MXFP8 ND/DN/Exp2D)
- lib/TileOps/a5/tinsert.py: tinsert template
- lib/TileOps/__init__.py: register tquant/tinsert templates
- include/PTO/IR/PTOOps.td: tquant op definitions
- lib/PTO/IR/VPTO.cpp: vbitcast sub-byte support (f4e2m1x2→ui8)
- lib/PTO/IR/PTO.cpp: TQuantMxOp verifier (grp_axis/interleave/DN refactor)
- lib/PTO/Transforms/ExpandTileOp.cpp: tquant operand attrs
- lib/PTO/Transforms/InsertTemplateAttributes.cpp: tquant template attrs
- lib/PTO/Transforms/PTOToEmitC.cpp: TQuantMxOp EmitC lowering
- lib/PTO/Transforms/VPTO{CANN900,}LLVMEmitter.cpp: vcvt f16→bf16 support
- tools/ptoas/ptoas.cpp: InsertTemplateAttributes pass in VPTO pipeline
- ptodsl/ptodsl/_ops.py: tquant/tassign/tquant_mx/set_ctrl API + vcvt_contract
- ptodsl/ptodsl/_tile_namespace.py: tile.quant namespace
- ptodsl/ptodsl/pto.py: export set_ctrl, tassign
- ptodsl/ptodsl/tilelib/serving/{client,daemon}.py: daemon error traceback
- test/tilelib-st/a5/tquant/: 86 cases (INT8 6 + MXFP8 49 + MXFP4 25 + DN 6)
- test/tilelib-st/a5/{tassign,tinsert_vec_to_mat}/: supporting tests
- test/lit/pto/tquant_*.pto: lit tests
- test/tilelib-st/common.py: bf16/assert_close enhancement
The debug tofile calls wrote to the hard-coded /tmp/opencode path, which
does not exist on CI runners and caused PermissionError on every TileLib
ST case during golden comparison.
When case.py is loaded via importlib (run_tilelib_st.py / pytest entry),
sys.path[0] is not the case directory, so 'from _gen_data_nd import ...'
fails with ModuleNotFoundError. Add the case directory (parent) to sys.path
alongside the existing test/tilelib-st/ path (parent.parent for common).

This fixes 32 CI failures where MXFP4/DN cases could not import their
helper modules.
…tead of seeded rng

_gen_pattern's 'normal' pattern used np.random.lognormal/np.random.rand
(global random state) instead of the seeded rng (np.random.default_rng).
This caused CI/local data divergence because the global random state
depends on prior call history, not the per-case seed.

Fix: use rng.lognormal/rng.random so the seed_k parameter actually
controls data generation for 'normal' pattern cases.
The MLIR-generated bindings expose tmp as a keyword-only optional
operand (tsel(mask, src0, src1, dst, *, tmp=None), tsels(mask, src,
scalar, dst, *, tmp=None)) since the optional-tmp change. The ptodsl
wrappers still passed tmp positionally, colliding with the dst slot:

  TypeError: tsels() takes 4 positional arguments but 5 were given

This matches the pattern applied to trow*/tcolarg*/txor/txors in
68e079d, which missed tsel/tsels.
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.

1 participant