ADR 0047: Numeric rounding semantics
Historical-evidence note: test paths named below record the evidence used when this ADR was accepted; they are not active architecture or release owners. Current ownership is the four-surface ASL tree, with per-ID AVS coverage projected into
spec/evidence/release-traceability-readiness.json.
Decision scope
This decision completes the rounding decision and supersedes the result-open parts of ADR 0039. ADR 0049 separately closes subnormal handling for the named hardware profile; ADR 0087 and ADR 0088 through ADR 0095 remain outside this decision.
Affected domains
cube-matrixscalar-binaryscalar-fp-convertscalar-fp-to-integerscalar-fusedscalar-integer-to-fpscalar-unarytile-binarytile-converttile-dequantizetile-expandtile-fusedtile-partialtile-quantizetile-reductiontile-unary
Context
ADR 0039 separated the scalar active-rounding field, fixed scalar conversion
mnemonics, bundle RMode, public conversion controls, target controls, and
backend-only controls. It deliberately left their meanings and every
operation-domain rounding point open.
The remaining evidence contains two traps for an implementation:
- the scalar and bundle selectors are both three bits wide but do not share an encoding namespace; and
FCVTAmeans nearest with ties away from zero, not directed rounding away from zero for every inexact value.
PTO defines the scalar field location, the four assigned directional codes, and an RNE fallback for reserved values in the owning ASL.
Decision
Semantic modes
The ASL type NumericRoundingMode is the common semantic vocabulary:
| Name | Rule |
|---|---|
| RNE | nearest, ties to even |
| RTM | toward negative infinity |
| RTP | toward positive infinity |
| RTZ | toward zero |
| RNA | nearest, ties away from zero |
| RTO | if inexact, select the adjacent result whose least-significant retained integer bit is one |
| RHB | nearest; on an exact halfway case select the numerically greater candidate |
Encoded selector namespaces must translate explicitly to this type. Equal bit widths or ordinals never imply equal meanings.
Scalar active rounding
CORE_STATE[39:37] has four assigned active-rounding encodings:
| Raw value | Resolution |
|---|---|
000 | RNE |
001 | RTM |
010 | RTP |
011 | RTZ |
100–111 | reserved; resolve to RNE |
The reserved fallback is deterministic and has no trap or other architectural
effect. It does not import meanings from bundle RMode.
Scalar floating binary, unary, format-conversion, and integer-to-floating operations use the resolved active mode when encoding their destination. Fused multiply-add variants evaluate the exact fused expression and round once at the destination boundary.
Fixed scalar conversions
The conversion mnemonic, not CORE_STATE.FRM, selects the mode:
| Mnemonic | Mode |
|---|---|
FCVTA | RNA |
FCVTM | RTM |
FCVTN | RNE |
FCVTP | RTP |
FCVTZ | RTZ |
The finite source is rounded once before ADR 0090 selects an out-of-range, indefinite, or saturation result. This decision fixes the order but leaves those ADR 0090 results open.
Bundle and public conversion selectors
B.DATR.RMode has the following complete mapping:
| Raw value | Bundle name | Semantic mode |
|---|---|---|
000 | NONE | operation-defined default |
001 | RNE | RNE |
010 | RTZ | RTZ |
011 | RDN | RTM |
100 | RUP | RTP |
101 | RNA | RNA |
110 | RTO | RTO |
111 | RHB | RHB |
The public conversion enumeration is a separate namespace and translates as follows:
| Public value | Public name | Bundle selection |
|---|---|---|
| 0 | CAST_NONE | NONE |
| 1 | CAST_RINT | RNE |
| 2 | CAST_ROUND | RNA |
| 3 | CAST_FLOOR | RDN |
| 4 | CAST_CEIL | RUP |
| 5 | CAST_TRUNC | RTZ |
| 6 | CAST_ODD | RTO |
Public value 7 is unassigned and rejects before effects. There is no public RHB ordinal in this version. Backend tokens with similar names remain non-normative unless another accepted profile decision maps them.
Only ACCCVT, TCVT, TQUANT, and TDEQUANT consume
TileNumericSelection. NONE resolves to RNE except that floating-to-integer
TCVT resolves NONE to RTZ. An explicit bundle code always overrides that
default. These operations round at the destination-format boundary before
saturation. Saturation-disabled range results remain ADR 0090 decisions.
Operation-fixed domains
All other tile operations ignore bundle RMode and use operation-fixed rules:
- floating elementwise, expansion, partial, and PReLU results use RNE at each operation-defined destination boundary; exact integer, bitwise, comparison, minimum, maximum, broadcast, and selection results do not round;
- reductions visit elements in increasing logical row-major order and round every floating sum or product step to the declared accumulator type using RNE; minimum, maximum, and argument selection do not round; and
- matrix operations visit K in increasing logical order, perform one
RNE-rounded fused multiply-add into the declared accumulator per term, and
apply any post-dot bias with RNE.
ACCCVTowns the later accumulator conversion.
The generated domain ledger records the rule and saturation ordering for all 16 affected rounding domains and 100 affected operations.
Rejected alternatives
- Treating scalar raw values 4 through 7 as the bundle modes was rejected because it conflates distinct architectural namespaces.
- Rejecting reserved scalar values before effects was rejected because PTO defines a deterministic RNE fallback.
- Defining
FCVTAas directed away from zero was rejected because it changes non-halfway values and conflicts with the mnemonic's ties-away contract. - Passing public enumeration ordinals directly into
B.DATR.RModewas rejected becauseCAST_ROUND,CAST_FLOOR,CAST_CEIL, andCAST_TRUNChave different ordinals from their bundle encodings.
Consequences
This decision is complete for selector encodings, tie rules, operation defaults, rounding points, and rounding-before-saturation order. The ASL carries semantic rounding values rather than ambiguous raw codes across profile hooks.
This decision does not claim complete numeric results. Format encodings and legality, special values, flags, overflow and indefinite results, approximation error, reduction tie behavior, quantization equations, matrix precision beyond the stated rounding points, and bounded target variation remain owned by ADR 0087 and ADR 0088 through ADR 0095. ADR 0049 separately owns subnormal handling for the named hardware profile. Stage 5 therefore remains in progress.
Evidence
asl/types.aslasl/scalar/floating.aslasl/scalar/dispatch.aslasl/bundle/dispatch.aslasl/tile/conversion.aslasl/tile/cube.aslspec/catalog/tile-operations.jsonspec/hardware-conformance-profile.jsonspec/evidence/numeric-rounding-selector-contract.jsonscripts/generate-numeric-rounding-selector-contracttests/asl/arch/data-types/rounding/arch-static-rounding-contract-001.asltests/asl/scalar/model/dispatch/fsu/scalar-exec-flag-and-rounding-helpers-001.asltests/asl/tile/model/numeric/rounding/tile-static-rounding-contract-001.aslspec/evidence/release-traceability-readiness.json