FlagTensor Accuracy Policy#
Scope#
This document defines the acceptance-facing accuracy policy for FlagTensor correctness validation.
Reference Policy#
Unary and binary operators use mathematically equivalent PyTorch expressions as the primary reference.
cuTensor-backed contraction operators may compare against either CPU references or cuTensor references depending on operator semantics and numerical stability.
Any operator with special numerical behavior must document its reference choice in the test implementation.
Assertion Policy#
Bit-exact operators should use equality-style assertions.
Floating-point operators should use close-style assertions.
All default close-style assertions should use centralized helper APIs from
src/flagtensor/testing/.Acceptance-style tests may re-export these helpers through
tests/accuracy_utils.py.
Default Tolerances#
Dtype |
atol |
rtol |
|---|---|---|
|
|
|
|
|
|
|
|
|
Complex tolerances are not defined: Triton does not natively support complex dtypes. The only operator with complex support is conj, which handles complex via a dedicated kernel that decomposes real/imag parts at the Python level before launching Triton.
Shape Policy#
Pointwise operators must cover representative small, medium, and multi-dimensional shapes.
Contraction operators must cover layout-sensitive and chain-sensitive shapes.
Sparse operators must cover both dense-value correctness and structure preservation.
Shared default shape helpers should come from centralized testing utilities rather than per-test duplication.
Dtype Coverage Policy#
Default correctness coverage includes
float16,float32, andbfloat16where operator support is stable.Complex dtype (
complex64,complex128) is only supported forconj. Tritonβs type system does not support complex natively, so all other unary operators reject complex inputs at the executor level.Benchmark coverage includes
float16andfloat32for all operator categories.
Skip / Block Policy#
Operators with known instability may be marked
blockedinconf/operators.yaml.Blocked operators must include a
skip_reason.CI and weekly workflows exclude blocked operators by default unless
--include-blockedis explicitly requested.
Source of Truth#
Registry metadata:
conf/operators.yamlShared helpers:
src/flagtensor/testing/Compatibility exports:
tests/accuracy_utils.pyStrategy overview:
docs/testing_strategy.md