1// PTO-UNIT: {"id":"PTO-ARCH-DATA-TYPES-FORMAT-HIF4-SCALE","surface":"arch","classification":["data-types","formats","hif4-scale"],"depends_on":["PTO-ARCH-DATA-TYPES-FP19"]}23// NDF-BEGIN: PTO-CUBE-HIF4-SCALE-0014// ndf: kind=contract level=L1 layer=architecture status=accepted5// A HiF4 Matrix scale MUST be one raw U32 word containing E6M2 in bits 7:0,6// eight E1_8 exponents in bits 15:8, and sixteen E1_16 exponents in bits7// 31:16. E6M2 values 00..FE MUST be finite with bias 48 and two fraction8// bits; FF MUST be a legal quiet NaN scale. One word scales 64 logical HiF49// lanes through the selected E1_8 plus E1_16 exponent bits.10// NDF-END: PTO-CUBE-HIF4-SCALE-0011112purefuncHiF4E6M2ValueClass(value:bits(8))=> NumericValueClass13begin14if value ==Ones{8}thenreturn NumericValue_QuietNaN;end;15return NumericValue_PositiveNormal;16end;1718purefuncHiF4E6M2FiniteValue(value:bits(8))=>real19begin20assert value !=Ones{8};21let exponent =(UInt(value[7:2])-48)asinteger{-48..15};22let mantissa_quarters =4+UInt(value[1:0]);23return(Real(mantissa_quarters)/4.0)*FP19PowerOfTwo(exponent);24end;2526purefuncHiF4ScaleExponentIncrement(27 scale_word:bits(32), q:integer{0..63})=>integer{0..2}28begin29let e1_8_index =8+(q DIVRM 8);30let e1_16_index =16+(q DIVRM 4);31returnUInt(scale_word[e1_8_index])+32UInt(scale_word[e1_16_index]);33end;3435purefuncHiF4ScaleFiniteValue(36 scale_word:bits(32), q:integer{0..63})=>real37begin38assertHiF4E6M2ValueClass(scale_word[7:0])==39 NumericValue_PositiveNormal;40returnHiF4E6M2FiniteValue(scale_word[7:0])*41FP19PowerOfTwo(HiF4ScaleExponentIncrement(scale_word, q));42end;43
Architecture behavior
purpose scope
Purpose and scope
A HiF4 Matrix scale is one 32-bit raw word used with 64 logical HiF4 lanes. This page explains how the base E6M2 field and two levels of exponent-selection bits combine; exact behavior remains in PTO-CUBE-HIF4-SCALE-001 and its ASL functions.
concepts state
Scale-word layout
Bits 7:0 hold one E6M2 base scale, bits 15:8 hold eight E1_8 exponent bits, and bits 31:16 hold sixteen E1_16 exponent bits.
For lane index q in 0..63, HiF4ScaleExponentIncrement selects bit 8 + (q DIVRM 8) and bit 16 + (q DIVRM 4), then adds the two selected bits to produce an increment from 0 through 2.
rules interactions
Base value and lane scale
E6M2 encodings 0x00 through 0xfe are finite positive values with bias 48 and two fraction bits. 0xff is a legal quiet NaN scale.
For a finite base, HiF4ScaleFiniteValue multiplies HiF4E6M2FiniteValue by FP19PowerOfTwo(increment), where increment is returned by HiF4ScaleExponentIncrement. The function requires the base field to classify as NumericValue_PositiveNormal.
boundaries
Boundaries
0x00 denotes 2^-48; 0xfe denotes 1.5 * 2^15; 0xff is not accepted by HiF4E6M2FiniteValue because it is the quiet NaN encoding.
Each E1_8 bit is shared by eight consecutive logical lanes, while each E1_16 bit is shared by four. The selected pair, not the other exponent bits in the word, affects a given q.
example usage
illustrative reading example
This example illustrates indexing and does not add a scale rule.
With base 0x00, E1_8 bit 8 set, and E1_16 bit 16 set, lane q = 0 gets increment 2 and scale 2^-46; lane q = 8 selects different exponent bits and gets increment 0 in the AVS fixture.
HiF4X2 defines the packed HiF4 logical-lane value format.
NDF clauses
Bodies come from owning ASL. Dragging or buttons change only this page-session view order.
surfaceARCH
ownerPTO-ARCH-DATA-TYPES-FORMAT-HIF4-SCALE
categoryCUBE-HIF4-SCALE
case001
Normative contract
contract · L1 · accepted
A HiF4 Matrix scale MUST be one raw U32 word containing E6M2 in bits 7:0,
eight E1_8 exponents in bits 15:8, and sixteen E1_16 exponents in bits
31:16. E6M2 values 00..FE MUST be finite with bias 48 and two fraction
bits; FF MUST be a legal quiet NaN scale. One word scales 64 logical HiF4
lanes through the selected E1_8 plus E1_16 exponent bits.