Skip to main content

PTO-ARCH-PROFILE-E8M0-CONVERSION

PTO-ARCH-PROFILE-E8M0-CONVERSION

ASL pseudocode

This Operation comes directly from the instruction owner; the page does not rewrite its behavior.

pure func HardwareTCVTE8M0SourceTypeSupported(    source_type: TileDataType) => booleanbegin    return source_type == TileDataType_FP16 ||           source_type == TileDataType_BF16 ||           source_type == TileDataType_FP32;end;
pure func HardwareTCVTTypePairSupported(    source_type: TileDataType,    destination_type: TileDataType) => booleanbegin    if destination_type == TileDataType_E8M0 then        return HardwareTCVTE8M0SourceTypeSupported(source_type);    end;    return TRUE;end;
pure func ReferenceE8M0HighestSetBit(    significand: Word) => integer {0..63}begin    assert !IsZero(significand);    var highest: integer {0..63} = 0;    for position = 0 to 63 do        if significand[position] == '1' then            highest = position as integer {0..63};        end;    end;    return highest;end;
pure func ReferenceE8M0RoundExponent(    significand: Word,    exponent: integer {-1074..1023},    mode: NumericRoundingMode) => (integer {-149..128}, boolean)begin    let highest = ReferenceE8M0HighestSetBit(significand);    let floor_candidate = exponent + highest;    assert -149 <= floor_candidate && floor_candidate <= 127;    let floor_exponent = floor_candidate as integer {-149..127};    let exact_power = significand ==        LSL(Zeros{PTO_XLEN} + 1, highest);    if exact_power then        return (floor_exponent, TRUE);    end;
    let ceiling_exponent = (floor_exponent + 1) as integer {-148..128};    if mode == NumericRound_RTM then        return (floor_exponent, FALSE);    elsif mode == NumericRound_RTP then        return (ceiling_exponent, FALSE);    elsif mode == NumericRound_RTZ then        if floor_exponent < 0 then            return (ceiling_exponent, FALSE);        else return (floor_exponent, FALSE);        end;    elsif mode == NumericRound_RTO then        if floor_exponent MOD 2 != 0 then            return (floor_exponent, FALSE);        else return (ceiling_exponent, FALSE);        end;    end;
    let square = MultiplyWord(significand, significand);    let boundary_shift = 2 * highest + 1;    assert boundary_shift <= 127;    let boundary = LSL(        Zeros{PTO_XLEN} + 1,        boundary_shift as integer {0..127});    if UInt(square) < UInt(boundary) then        return (floor_exponent, FALSE);    elsif UInt(square) > UInt(boundary) then        return (ceiling_exponent, FALSE);    elsif mode == NumericRound_RNE then        if floor_exponent MOD 2 == 0 then            return (floor_exponent, FALSE);        else return (ceiling_exponent, FALSE);        end;    elsif mode == NumericRound_RNA then        if floor_exponent < 0 then            return (floor_exponent, FALSE);        else return (ceiling_exponent, FALSE);        end;    else        assert mode == NumericRound_RHB;        return (ceiling_exponent, FALSE);    end;end;
func ReferenceFloatToE8M0(    value: Word,    source_type: TileDataType,    control: NumericExecutionControl) => (Word, bits(5))begin    assert HardwareTCVTE8M0SourceTypeSupported(source_type);    let value_class = TileNumericValueClass(source_type, value);    if value_class == NumericValue_InvalidEncoding ||       NumericValueClassIsNaN(value_class) ||       NumericValueClassIsZero(value_class) ||       value_class == NumericValue_NegativeInfinity ||       value_class == NumericValue_NegativeNormal ||       value_class == NumericValue_NegativeSubnormal then        return (Zeros{PTO_XLEN} + 0xff, Zeros{5} + 0x01);    elsif value_class == NumericValue_PositiveInfinity then        return (            if control.saturating then Zeros{PTO_XLEN} + 0xfe            else Zeros{PTO_XLEN} + 0xff,            Zeros{5} + 0x14);    end;
    let (available, negative, significand, exponent) =        TileNumericFiniteDecomposition(source_type, value);    assert available && !negative && !IsZero(significand);    let highest = ReferenceE8M0HighestSetBit(significand);    let floor_candidate = exponent + highest;    assert -149 <= floor_candidate && floor_candidate <= 127;    let floor_exponent = floor_candidate as integer {-149..127};    let exact_power = significand ==        LSL(Zeros{PTO_XLEN} + 1, highest);    if floor_exponent < -127 then        return (            if control.saturating then Zeros{PTO_XLEN}            else Zeros{PTO_XLEN} + 0xff,            Zeros{5} + 0x18);    elsif floor_exponent == 127 && !exact_power then        return (            if control.saturating then Zeros{PTO_XLEN} + 0xfe            else Zeros{PTO_XLEN} + 0xff,            Zeros{5} + 0x14);    end;
    let (rounded_exponent, exact) = ReferenceE8M0RoundExponent(        significand, exponent, control.rounding_mode);    assert -127 <= rounded_exponent && rounded_exponent <= 127;    let code = (rounded_exponent + 127) as integer {0..254};    return (        Zeros{PTO_XLEN} + code,        if exact then Zeros{5} else Zeros{5} + 0x10);end;
implementation func TileProfileConvert(    value: Word,    source_type: TileDataType,    destination_type: TileDataType,    control: NumericExecutionControl) => (Word, bits(5))begin    if destination_type == TileDataType_E8M0 then        return ReferenceFloatToE8M0(value, source_type, control);    elsif !TileDataTypeIsFloating(destination_type) then        return (            NormalizeTileInteger(value, destination_type),            Zeros{5});    end;    return (value, Zeros{5});end;
View the complete ASL owner
// PTO-UNIT: {"id":"PTO-ARCH-PROFILE-E8M0-CONVERSION","surface":"arch","classification":["profile","e8m0-conversion"],"depends_on":["PTO-ARCH-PROFILE-REFERENCE-QUANTIZATION","PTO-ARCH-DATA-TYPES-NUMERIC-FORMATS"]}
// NDF-BEGIN: PTO-TCVT-E8M0-PROFILE-001// ndf: kind=executable level=L3 layer=architecture status=accepted// TCVT to E8M0 MUST accept only FP16, BF16, and FP32 sources. Positive// finite values MUST round their base-two exponent under the selected RMode.// Zero, negative values, and NaNs MUST produce 0xFF with NV. Positive// infinity and finite range overflow or underflow MUST produce 0xFF when Sat// is zero and the corresponding finite endpoint when Sat is one, with exact// OF or UF plus NX status. Canonicalize MUST retain its representation role.// NDF-END: PTO-TCVT-E8M0-PROFILE-001
// DOC-BEGIN: operationpure func HardwareTCVTE8M0SourceTypeSupported(    source_type: TileDataType) => booleanbegin    return source_type == TileDataType_FP16 ||           source_type == TileDataType_BF16 ||           source_type == TileDataType_FP32;end;
pure func HardwareTCVTTypePairSupported(    source_type: TileDataType,    destination_type: TileDataType) => booleanbegin    if destination_type == TileDataType_E8M0 then        return HardwareTCVTE8M0SourceTypeSupported(source_type);    end;    return TRUE;end;
pure func ReferenceE8M0HighestSetBit(    significand: Word) => integer {0..63}begin    assert !IsZero(significand);    var highest: integer {0..63} = 0;    for position = 0 to 63 do        if significand[position] == '1' then            highest = position as integer {0..63};        end;    end;    return highest;end;
pure func ReferenceE8M0RoundExponent(    significand: Word,    exponent: integer {-1074..1023},    mode: NumericRoundingMode) => (integer {-149..128}, boolean)begin    let highest = ReferenceE8M0HighestSetBit(significand);    let floor_candidate = exponent + highest;    assert -149 <= floor_candidate && floor_candidate <= 127;    let floor_exponent = floor_candidate as integer {-149..127};    let exact_power = significand ==        LSL(Zeros{PTO_XLEN} + 1, highest);    if exact_power then        return (floor_exponent, TRUE);    end;
    let ceiling_exponent = (floor_exponent + 1) as integer {-148..128};    if mode == NumericRound_RTM then        return (floor_exponent, FALSE);    elsif mode == NumericRound_RTP then        return (ceiling_exponent, FALSE);    elsif mode == NumericRound_RTZ then        if floor_exponent < 0 then            return (ceiling_exponent, FALSE);        else return (floor_exponent, FALSE);        end;    elsif mode == NumericRound_RTO then        if floor_exponent MOD 2 != 0 then            return (floor_exponent, FALSE);        else return (ceiling_exponent, FALSE);        end;    end;
    let square = MultiplyWord(significand, significand);    let boundary_shift = 2 * highest + 1;    assert boundary_shift <= 127;    let boundary = LSL(        Zeros{PTO_XLEN} + 1,        boundary_shift as integer {0..127});    if UInt(square) < UInt(boundary) then        return (floor_exponent, FALSE);    elsif UInt(square) > UInt(boundary) then        return (ceiling_exponent, FALSE);    elsif mode == NumericRound_RNE then        if floor_exponent MOD 2 == 0 then            return (floor_exponent, FALSE);        else return (ceiling_exponent, FALSE);        end;    elsif mode == NumericRound_RNA then        if floor_exponent < 0 then            return (floor_exponent, FALSE);        else return (ceiling_exponent, FALSE);        end;    else        assert mode == NumericRound_RHB;        return (ceiling_exponent, FALSE);    end;end;
func ReferenceFloatToE8M0(    value: Word,    source_type: TileDataType,    control: NumericExecutionControl) => (Word, bits(5))begin    assert HardwareTCVTE8M0SourceTypeSupported(source_type);    let value_class = TileNumericValueClass(source_type, value);    if value_class == NumericValue_InvalidEncoding ||       NumericValueClassIsNaN(value_class) ||       NumericValueClassIsZero(value_class) ||       value_class == NumericValue_NegativeInfinity ||       value_class == NumericValue_NegativeNormal ||       value_class == NumericValue_NegativeSubnormal then        return (Zeros{PTO_XLEN} + 0xff, Zeros{5} + 0x01);    elsif value_class == NumericValue_PositiveInfinity then        return (            if control.saturating then Zeros{PTO_XLEN} + 0xfe            else Zeros{PTO_XLEN} + 0xff,            Zeros{5} + 0x14);    end;
    let (available, negative, significand, exponent) =        TileNumericFiniteDecomposition(source_type, value);    assert available && !negative && !IsZero(significand);    let highest = ReferenceE8M0HighestSetBit(significand);    let floor_candidate = exponent + highest;    assert -149 <= floor_candidate && floor_candidate <= 127;    let floor_exponent = floor_candidate as integer {-149..127};    let exact_power = significand ==        LSL(Zeros{PTO_XLEN} + 1, highest);    if floor_exponent < -127 then        return (            if control.saturating then Zeros{PTO_XLEN}            else Zeros{PTO_XLEN} + 0xff,            Zeros{5} + 0x18);    elsif floor_exponent == 127 && !exact_power then        return (            if control.saturating then Zeros{PTO_XLEN} + 0xfe            else Zeros{PTO_XLEN} + 0xff,            Zeros{5} + 0x14);    end;
    let (rounded_exponent, exact) = ReferenceE8M0RoundExponent(        significand, exponent, control.rounding_mode);    assert -127 <= rounded_exponent && rounded_exponent <= 127;    let code = (rounded_exponent + 127) as integer {0..254};    return (        Zeros{PTO_XLEN} + code,        if exact then Zeros{5} else Zeros{5} + 0x10);end;
implementation func TileProfileConvert(    value: Word,    source_type: TileDataType,    destination_type: TileDataType,    control: NumericExecutionControl) => (Word, bits(5))begin    if destination_type == TileDataType_E8M0 then        return ReferenceFloatToE8M0(value, source_type, control);    elsif !TileDataTypeIsFloating(destination_type) then        return (            NormalizeTileInteger(value, destination_type),            Zeros{5});    end;    return (value, Zeros{5});end;// DOC-END: operation

Architecture behavior

purpose scope

Purpose and scope

This unit supplies the PTO reference conversion path for TCVT with destination type E8M0. It defines accepted source types, exponent selection under RMode, exceptional encodings, saturation endpoints, and five-bit numeric status.

concepts state

Inputs and representation

  • Supported sources are FP16, BF16, and FP32; other source-to-E8M0 pairs fail the type-pair predicate.
  • Finite positive input is decomposed into a significand and base-two exponent.
  • Encoded finite results use exponent plus 127, producing codes from 0x00 through 0xfe; 0xff is used by the exceptional paths.
rules interactions

Conversion rules

  • Exact powers of two preserve their exponent and report no inexact status.
  • Non-powers use ReferenceE8M0RoundExponent, which implements RTM, RTP, RTZ, RTO, RNE, RNA, and RHB choices.
  • Zero, negative values, and NaNs return 0xff with NV.
  • ReferenceFloatToE8M0 also routes NumericValue_InvalidEncoding to 0xff with NV.
  • Positive infinity and finite overflow or underflow choose 0xff without saturation or the finite endpoint with saturation, and report the corresponding OF or UF plus NX.
boundaries

Boundaries

TileProfileConvert delegates only destination E8M0 to this path. Non-floating integer destinations use NormalizeTileInteger; other floating destinations are returned unchanged by this owner. Canonicalize remains a representation concern outside this conversion helper.

example usage

illustrative conversion example

Use this example block only as a reading aid: apply the rules above, then confirm the result in the normative ASL owner. It does not add an architectural contract.

Related owners

  • Reference quantization provides shared finite-value and numeric helpers.
  • Numeric-format owners classify source encodings; TCVT owns operation legality and publication.

NDF clauses

Bodies come from owning ASL. Dragging or buttons change only this page-session view order.

    1. surfaceARCH
    2. ownerPTO-ARCH-PROFILE-E8M0-CONVERSION
    3. categoryTCVT-E8M0-PROFILE
    4. case001

    executable

    executable · L3 · accepted

    TCVT to E8M0 MUST accept only FP16, BF16, and FP32 sources. Positive finite values MUST round their base-two exponent under the selected RMode. Zero, negative values, and NaNs MUST produce 0xFF with NV. Positive infinity and finite range overflow or underflow MUST produce 0xFF when Sat is zero and the corresponding finite endpoint when Sat is one, with exact OF or UF plus NX status. Canonicalize MUST retain its representation role.

    Sources and references
    Complete stable ID
    PTO-TCVT-E8M0-PROFILE-001
    Source path
    asl/arch/profile/e8m0-conversion.asl
    Affected units
    PTO-ARCH-PROFILE-E8M0-CONVERSION
    Source SHA-256
    e46324c90eff21e4270558e315c684089f11b6d6a47f6dc4ee0b30411761fd57
    Clause SHA-256
    1074a1c6d468568182ed4e6215afe07d763b9ccf44a93e948a7422cc8f6a83d1
    Open exact canonical source ↗

Evidence index

9 matching entries

Executable evidence1
  • PTO-ARCH-PROFILE-E8M0-CONVERSION compiles as an independent normative unit
    1. surfaceARCH
    2. ownerPTO-ARCH-PROFILE-E8M0-CONVERSION
    3. categorySTATIC-INVARIANT
    4. case001
    Show exact test source
    Sources and references
    Complete stable ID
    PTO-AVS-ARCH-PROFILE-E8M0-CONVERSION-STATIC-001
    Path
    tests/asl/arch/profile/e8m0-conversion/arch-static-e8m0-conversion-contract-001.asl
    Kind / role
    static-invariant
    Requirements
    PTO-TCVT-E8M0-PROFILE-001
    Pass condition
    the complete model and this unit's static invariant compile
    SHA-256
    d31ebb831d59bacd869f07e8b9e3676b1e73d8fa8377fec8f19196b0da416cec
    Open exact source ↗ for PTO-AVS-ARCH-PROFILE-E8M0-CONVERSION-STATIC-001
Commit-scoped evidence5
  • spec/evidence/release-traceability-readiness.json · closedPTO-EVIDENCE-RELEASE-TRACEABILITY
    Sources and references
    Complete stable ID
    PTO-EVIDENCE-RELEASE-TRACEABILITY
    Path
    spec/evidence/release-traceability-readiness.json
    Kind / role
    ASL/NDF/documentation/AVS traceability
    SHA-256
    c7327021d39dc67ac5564bc55073b3870a397d79ac8d9648284d56e33bc14a3e
    Open exact source ↗ for PTO-EVIDENCE-RELEASE-TRACEABILITY
  • spec/evidence/instruction-contract-closure.json · closedPTO-EVIDENCE-INSTRUCTION-CONTRACT-CLOSURE
    Sources and references
    Complete stable ID
    PTO-EVIDENCE-INSTRUCTION-CONTRACT-CLOSURE
    Path
    spec/evidence/instruction-contract-closure.json
    Kind / role
    mnemonic and encoding contract closure
    SHA-256
    3ef2bb62421c79dff8fa77a1c7983923b523244b8090812883ef81286ca8106a
    Open exact source ↗ for PTO-EVIDENCE-INSTRUCTION-CONTRACT-CLOSURE
  • spec/evidence/architecture-readiness.json · openPTO-EVIDENCE-ARCHITECTURE-READINESS
    Sources and references
    Complete stable ID
    PTO-EVIDENCE-ARCHITECTURE-READINESS
    Path
    spec/evidence/architecture-readiness.json
    Kind / role
    architecture maturity and blockers
    SHA-256
    4b0b85199101251bea744e0f3591cc31906909dc80d5ab651c417a936036a004
    Open exact source ↗ for PTO-EVIDENCE-ARCHITECTURE-READINESS
  • spec/evidence/release-gate-readiness.json · ready-for-exact-head-verificationPTO-EVIDENCE-RELEASE-GATE-READINESS
    Sources and references
    Complete stable ID
    PTO-EVIDENCE-RELEASE-GATE-READINESS
    Path
    spec/evidence/release-gate-readiness.json
    Kind / role
    exact-head gate readiness
    SHA-256
    a0f4d2b6920c08981ea55fd8ef820708a40d4feb5402c5150e8e9ab532d84ce0
    Open exact source ↗ for PTO-EVIDENCE-RELEASE-GATE-READINESS
  • spec/release-manifest.json · draftPTO-EVIDENCE-RELEASE-MANIFEST
    Sources and references
    Complete stable ID
    PTO-EVIDENCE-RELEASE-MANIFEST
    Path
    spec/release-manifest.json
    Kind / role
    release content and encoding fingerprints
    SHA-256
    1a64c109ed7a90351c41e2a418b3c0ebaf8ad975838986d2101385186b85c0d8
    Open exact source ↗ for PTO-EVIDENCE-RELEASE-MANIFEST
Decision history3
  • PTO v0 concrete reference profile · accepted
    1. decision recordADR
    2. case0005

    Decision record

    Loading ADR-0005…

    Sources and references
    Complete stable ID
    ADR-0005
    Path
    docs/status/decisions/0005-pto-v0-concrete-reference-profile.md
    Affected units
    PTO-ARCH-PROFILE-APPLICABILITY, PTO-ARCH-PROFILE-E8M0-CONVERSION, PTO-ARCH-PROFILE-EXTENSION-FIRST-USE, PTO-ARCH-PROFILE-MATRIX-POSTPROCESS, PTO-ARCH-PROFILE-MATRIX-QUANTIZATION, PTO-ARCH-PROFILE-REFERENCE-PROFILE, PTO-ARCH-PROFILE-REFERENCE-QUANTIZATION, PTO-ARCH-PROFILE-RESET, PTO-ARCH-PROFILE-TRAP-CONTEXT-RECOVERY
    Affected NDF
    PTO-ARCH-EXTENSION-FIRST-USE-PROFILE-001, PTO-MATRIX-POSTPROCESS-BITEXACT-001, PTO-MATRIX-QUANT-BITEXACT-001, PTO-TCVT-E8M0-PROFILE-001
    SHA-256
    a83528c2fc744cc120c2a0a32c82410059638ea88936fa65ac0eb36a0274d87c
    Open exact decision source ↗ for ADR-0005
  • Numeric profile identity and bounded variation framework · accepted
    1. decision recordADR
    2. case0037

    Decision record

    Loading ADR-0037…

    Sources and references
    Complete stable ID
    ADR-0037
    Path
    docs/status/decisions/0037-numeric-profile-identity-and-variation-framework.md
    Affected units
    PTO-ARCH-PROFILE-APPLICABILITY, PTO-ARCH-PROFILE-E8M0-CONVERSION, PTO-ARCH-PROFILE-MATRIX-POSTPROCESS, PTO-ARCH-PROFILE-MATRIX-QUANTIZATION, PTO-ARCH-PROFILE-REFERENCE-PROFILE, PTO-ARCH-PROFILE-REFERENCE-QUANTIZATION
    Affected NDF
    PTO-MATRIX-POSTPROCESS-BITEXACT-001, PTO-MATRIX-QUANT-BITEXACT-001, PTO-TCVT-E8M0-PROFILE-001
    SHA-256
    b09efd36ccfc7258d1743c974f42b875ead42137c503f576a12f471f65b52e30
    Open exact decision source ↗ for ADR-0037
  • Numeric variation-point ownership · accepted
    1. decision recordADR
    2. case0042

    Decision record

    Loading ADR-0042…

    Sources and references
    Complete stable ID
    ADR-0042
    Path
    docs/status/decisions/0042-numeric-variation-point-ownership.md
    Affected units
    PTO-ARCH-PROFILE-APPLICABILITY, PTO-ARCH-PROFILE-E8M0-CONVERSION, PTO-ARCH-PROFILE-MATRIX-POSTPROCESS, PTO-ARCH-PROFILE-MATRIX-QUANTIZATION, PTO-ARCH-PROFILE-REFERENCE-PROFILE, PTO-ARCH-PROFILE-REFERENCE-QUANTIZATION
    Affected NDF
    PTO-MATRIX-POSTPROCESS-BITEXACT-001, PTO-MATRIX-QUANT-BITEXACT-001, PTO-TCVT-E8M0-PROFILE-001
    SHA-256
    f25df23306837e4199f6b7c03f70de853a693fdc6435c65ead57b2a174076081
    Open exact decision source ↗ for ADR-0042

Unit metadata

Open 4 generated metadata fields
id
PTO-ARCH-PROFILE-E8M0-CONVERSION
surface
arch
classification
[
  "profile",
  "e8m0-conversion"
]
depends_on
[
  "PTO-ARCH-PROFILE-REFERENCE-QUANTIZATION",
  "PTO-ARCH-DATA-TYPES-NUMERIC-FORMATS"
]
Open generated traceability record
{
  "classification": [
    "profile",
    "e8m0-conversion"
  ],
  "documentation": "docs/arch/profile/e8m0-conversion.md",
  "id": "PTO-ARCH-PROFILE-E8M0-CONVERSION",
  "mnemonic": null,
  "readiness_subjects": [
    "ADR-0005",
    "ADR-0037",
    "ADR-0042"
  ],
  "semantic_tests": [],
  "source": "asl/arch/profile/e8m0-conversion.asl",
  "surface": "arch",
  "tests": [
    "PTO-AVS-ARCH-PROFILE-E8M0-CONVERSION-STATIC-001"
  ]
}

Sources and release identity

Show commit, paths, hashes, version, and canonical owners
Release
0.58.5 · Release candidate
Commit
7dc8b7e5b121d2b2499a2273bebff29e2cd86812
ASL SHA-256
e46324c90eff21e4270558e315c684089f11b6d6a47f6dc4ee0b30411761fd57
Generated documentation
docs/arch/profile/e8m0-conversion.md · embedded in this page
Documentation SHA-256
5904a9f4af89a6a049a27857559aa5f2b6d71347f04865c66949627f34d35b7e

Exact owners