[BACKEND][MTHREADS] Low-precision float support: resolve_dot capability rules, fp8 dual whitelist, SQMMA/WMMA fp8 lowering fixes - #1114
Closed
zeroherolin wants to merge 2 commits into
Conversation
…, fp8 cast dtype routing, interpreter float conversion rewrite, precision tutorials Common-layer groundwork for per-backend low-precision float support: - backends/compiler.py: DotCap/DotSupport, the answer type for the new optional resolve_dot / resolve_dot_scaled codegen-function queries. Backends that do not register them keep the legacy dot dtype rules. - language/semantic.py: query resolve_dot(_scaled) once shapes are known; reject UNSUPPORTED combinations and warn on EMULATED ones. fp8 cast routing via supported_fp8_cast_dtypes / custom_cast_fp8_dtypes options; the default preserves the legacy fp8e4b15-only custom-cast routing. - runtime/interpreter.py: rewrite _convert_float as exact decode/encode through fp64 with strict RTNE/RTZ and correct fn/fnuz/none special-value conventions (the old path rounded half-up and mishandled specials); fnuz zero results encode as +0, never the sign-only NaN code. Also add the flagtree_hints parameter to create_load/create_masked_load to match the semantic layer's call signature. - backends/__init__.py: dunder probes on the lazy language-extensions proxy raise AttributeError instead of failing module resolution. - tutorials/precision: runnable fp8 (E4M3FN) and fp4 (E2M1) walkthroughs driven by the declared capabilities, portable across backends.
… contract, fp8 dual-whitelist field family, SQMMA/WMMA fp8 lowering fixes, enable_fp8_burst2 plumbing
zeroherolin
requested review from
Galaxy1458,
menchunlei,
sunnycase and
zhzhcookie
as code owners
September 7, 2026 02:59
Collaborator
Author
|
goto #1116 |
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.
Summary
MThreads implementation of the low-precision float capability contract from #1112.
backend/compiler.py: dual-whitelist field family —supported_fp8_dtypes(dot operands) vssupported_fp8_storage_dtypes(storage-only fnuz/e4b15 formats stay out oftl.dot);supported_fp8_cast_dtypes/custom_cast_fp8_dtypes(renamed fromcustom_fp8_dtypes);resolve_dot— same-type OCP fp8 dot with fp32 accumulator is native from cap31 when the block shape hits an 8-bit instruction tile, otherwiseEMULATEDvia the FMA fallback with the concrete reason in the diagnostic;resolve_dot_scaled— alwaysEMULATED(no native scaled-MMA path).AccelerateMUSAMatmul.cpp: SQMMA operands staged through a same-width bit container (i8 loads bitcast to fp8) are retyped withMemDescReinterpretOpto the element type the dot consumes; accelerated WMMA now bails out to the FMA fallback for fp16 accumulators/results outside the PH1 f16×f16 carrier path.Utility.cpp:replaceUsesAndPropagateTypehandles same-shapeMemDescReinterpretOpviews.Dialect.cpp:WmmaDotOp::verifyrequires A/B to share an element type (previously only bit width was checked, so e.g. fp8e4nv × fp8e5 passed the verifier and lowered incorrectly).enable_fp8_burst2: plumbed fromMUSAOptionsthrough the pass pipeline instead ofgetenvat lowering time, so it participates in the compile cache key; the pybind signature keeps a default for backward compatibility.spec/triton/: the overlay copies ofbackends/compiler.py,language/semantic.py,runtime/interpreter.pymirror the [FRONTEND] Low-precision float support: resolve_dot capability contract, fp8 cast routing, interpreter float conversion rewrite #1112 changes; the shared helper blocks are byte-identical to the core files (verified by diff), adapted only around the spec's_assert_dot_dtypes_validdual-whitelist gate.Behavior changes to be aware of
custom_fp8_dtypes→custom_cast_fp8_dtypesrename changes the options dataclass, which invalidates existing compile caches (no code references the old name anywhere in the tree).WmmaDotOp::verifyis stricter (same element type), which could reject IR that previously passed verification with mixed same-width operand types; no in-tree pass emits such IR.