Source/Packages

Accelerator.SM90.Instruction

packages/hardware/architectures/nvidia-sm90/src/Accelerator/SM90/Instruction.alpha

184 lines91 declarations9.3 KiBSHA-256 24470222b09e

Complete file · line 50

Instruction.alpha

Definition view
1module Accelerator.SM90.Instruction
2
3import Accelerator.SM86.Control
4import Accelerator.SM86.Instruction
5import Accelerator.SM86.Types
6import Accelerator.SM90.UniformOperands
7
8-- The sm_90 forms in which an SM86-shaped program's global-memory accesses
9-- and branches run on Hopper.  Every other instruction an SM86 program holds
10-- is decoded by Hopper as Ampere decodes it, so it keeps its SM86 word
11-- (Accelerator.SM90.Lowering); these are the ones whose bits must change:
12--
13--   * Global accesses take the raw address form `[Ra.64+URZ+offset]`: the
14--     64-bit address the register pair holds, with no memory descriptor.
15--     Ampere's encoders set the `desc[UR4]` bit (76) and name UR4, which
16--     Ampere ignores and Hopper honours -- it would read a descriptor from a
17--     uniform register no SM86 program loads.  The raw form is Mesa NAK's;
18--     ptxas never emits it, so its oracle is nvdisasm's reading of the words
19--     (reference/oracles/nvidia-sm90-ptxas/global-branch/README.md), and the
20--     H100 runs of 2026-10-10 (comparisons/h100/README.md) executed it.
21--   * BRA splits its displacement: bits 2..9 at instruction bits 16..23 and
22--     bits 10..57 at 34..81 (ptxas -arch=sm_90a output).
23--
24-- Offsets are byte counts (naturals): a global offset is the signed 24-bit
25-- immediate's non-negative half, as Accelerator.SM86's encoders admit it.
26
27family SM90GlobalLoadWidth : Type 0
28-- LDG.E: one 32-bit word
29constructor SM90GlobalLoad32
30-- LDG.E.128: four words into a register quad
31constructor SM90GlobalLoad128
32-- LDG.E.STRONG.GPU: one word, a strong load at the GPU's scope
33-- (ld.relaxed.gpu / ld.acquire.gpu less its fence): it reads the L2's
34-- word, not a stale L1 line -- what a spin on another CTA's flag needs
35constructor SM90GlobalLoad32Strong
36-- LDG.E.128.STRONG.GPU: four words, strong at the GPU's scope (another
37-- CTA's partial tile, read after its flag)
38constructor SM90GlobalLoad128Strong
39-- LDG.E.128.CONSTANT: the non-coherent read-only path (ld.global.nc).
40-- Its input must remain immutable; never use it to observe a CTA's writes.
41constructor SM90GlobalLoad128ReadOnly
42end-family
43
44family SM90GlobalStoreWidth : Type 0
45-- STG.E: one 32-bit word
46constructor SM90GlobalStore32
47-- STG.E.64: a register pair (an 8-byte-aligned address)
48constructor SM90GlobalStore64
49-- STG.E.128: a register quad (a 16-byte-aligned address)
50constructor SM90GlobalStore128
51-- STG.E.STRONG.GPU: one word, a strong store at the GPU's scope
52-- (st.relaxed.gpu; st.release.gpu is MEMBAR.ALL.GPU then this)
53constructor SM90GlobalStore32Strong
54end-family
55
56-- A branch's displacement in bytes from the next instruction, by direction:
57-- the encoder writes its two's complement.  A forward branch of 0 continues
58-- with the next instruction; a backward branch moves at least one word.
59family SM90BranchTarget : Type 0
60constructor SM90BranchForward
61field unrestricted sm90BranchForwardBytes : Nat
62constructor SM90BranchBackward
63field unrestricted sm90BranchBackwardBytes : Nat
64end-family
65
66-- PRMT uses four low selector nibbles. Registers also permit sign-byte
67-- replication through each nibble's high bit; no modifier mode is implicit.
68family SM90ByteSelector : Type 0
69constructor SM90ByteSelectorImmediate
70field unrestricted sm90ByteSelectorImmediateValue : Nat
71constructor SM90ByteSelectorRegister
72field unrestricted sm90ByteSelectorRegisterValue : (family SM86Register)
73end-family
74
75-- Allocation is a performance hint, independent of width and memory ordering.
76-- NoAllocate avoids filling L1 with streaming operands; it adds no ordering.
77family SM90LoadAllocation : Type 0
78constructor SM90LoadAllocate
79constructor SM90LoadNoAllocate
80end-family
81
82family SM90Instruction : Type 0
83-- SASS LDG.E[.128] Rd, [Ra.64+URZ+offset]
84constructor SM90LoadGlobal
85field unrestricted sm90LoadGlobalGuard : (family SM86InstructionGuard)
86field unrestricted sm90LoadGlobalWidth : (family SM90GlobalLoadWidth)
87field unrestricted sm90LoadGlobalAllocation : (family SM90LoadAllocation)
88field unrestricted sm90LoadGlobalDestination : (family SM86Register)
89field unrestricted sm90LoadGlobalAddress : (family SM86Register)
90field unrestricted sm90LoadGlobalOffset : Nat
91field unrestricted sm90LoadGlobalControl : (family SM86Control)
92-- Returning U32 add at GPU scope, through the CUDA global descriptor.
93-- Keep its descriptor pair explicit; raw-address ATOMG is not qualified.
94constructor SM90FetchAddGlobal32
95field unrestricted sm90FetchAddGuard : (family SM86InstructionGuard)
96field unrestricted sm90FetchAddDestination : (family SM86Register)
97field unrestricted sm90FetchAddAddress : (family SM86Register)
98field unrestricted sm90FetchAddValue : (family SM86Register)
99field unrestricted sm90FetchAddDescriptor : (family SM90UniformRegister)
100field unrestricted sm90FetchAddOffset : Nat
101field unrestricted sm90FetchAddControl : (family SM86Control)
102-- SASS STG.E[.64|.128] [Ra.64+URZ+offset], Rv
103constructor SM90StoreGlobal
104field unrestricted sm90StoreGlobalGuard : (family SM86InstructionGuard)
105field unrestricted sm90StoreGlobalWidth : (family SM90GlobalStoreWidth)
106field unrestricted sm90StoreGlobalAddress : (family SM86Register)
107field unrestricted sm90StoreGlobalValue : (family SM86Register)
108field unrestricted sm90StoreGlobalOffset : Nat
109field unrestricted sm90StoreGlobalControl : (family SM86Control)
110-- SASS LDGSTS.E.BYPASS.128 [Rs+sharedOffset], [Rg.64+sourceOffset]
111-- (cp.async.cg, 16 bytes): the asynchronous copy of Accelerator.SM86's
112-- SM86LoadGlobalToShared, in the raw global form.
113constructor SM90CopyGlobalToShared
114field unrestricted sm90CopyGlobalToSharedGuard : (family SM86InstructionGuard)
115field unrestricted sm90CopyGlobalToSharedAddress : (family SM86Register)
116field unrestricted sm90CopyGlobalToSharedOffset : Nat
117field unrestricted sm90CopyGlobalToSharedSource : (family SM86Register)
118field unrestricted sm90CopyGlobalToSharedSourceOffset : Nat
119field unrestricted sm90CopyGlobalToSharedControl : (family SM86Control)
120-- SASS BRA: continue at the instruction the target names.
121constructor SM90Branch
122field unrestricted sm90BranchGuard : (family SM86InstructionGuard)
123field unrestricted sm90BranchTarget : (family SM90BranchTarget)
124field unrestricted sm90BranchControl : (family SM86Control)
125-- SASS REDG.E.ADD.F32.FTZ.RN.STRONG.GPU [Ra.64+URZ+offset], Rv
126-- (red.global.add.f32): Rv added to the binary32 at the address atomically,
127-- rounded to nearest, subnormals flushed -- Accelerator.SM86's
128-- SM86ReduceGlobalAddFloat32 in the raw form.  RED's descriptor flag is bit
129-- 71, not 76: bit 76 is part of its operand type (F32.FTZ against F16x4;
130-- reference/oracles/nvidia-sm90-ptxas/global-branch/README.md).
131constructor SM90ReduceGlobalAddFloat32
132field unrestricted sm90ReduceGlobalGuard : (family SM86InstructionGuard)
133field unrestricted sm90ReduceGlobalAddress : (family SM86Register)
134field unrestricted sm90ReduceGlobalValue : (family SM86Register)
135field unrestricted sm90ReduceGlobalOffset : Nat
136field unrestricted sm90ReduceGlobalControl : (family SM86Control)
137-- Default-mode PRMT: each result byte selects one of {right,left}'s
138-- eight bytes, or replicates its sign byte when selector bit 3 is set.
139constructor SM90PermuteBytes
140field unrestricted sm90PermuteGuard : (family SM86InstructionGuard)
141field unrestricted sm90PermuteDestination : (family SM86Register)
142field unrestricted sm90PermuteLeft : (family SM86Register)
143field unrestricted sm90PermuteRight : (family SM86Register)
144field unrestricted sm90PermuteSelector : (family SM90ByteSelector)
145field unrestricted sm90PermuteControl : (family SM86Control)
146-- General three-register LOP3. The SM86-shaped helper fixes its third
147-- input to RZ; this form exposes all three operands and its byte table.
148constructor SM90LogicThree
149field unrestricted sm90LogicGuard : (family SM86InstructionGuard)
150field unrestricted sm90LogicDestination : (family SM86Register)
151field unrestricted sm90LogicFirst : (family SM86Register)
152field unrestricted sm90LogicSecond : (family SM86Register)
153field unrestricted sm90LogicThird : (family SM86Register)
154field unrestricted sm90LogicTruth : Byte
155field unrestricted sm90LogicControl : (family SM86Control)
156end-family
157
158-- Why an encoder or decoder refused: named, so a law can pin the reason.
159family SM90EncodingRefusal : Type 0
160-- a global offset at or above 2^23 (the immediate is signed)
161constructor SM90RefusalGlobalOffsetOutOfRange
162-- an LDGSTS source offset at or above 2^11 or shared offset at or above 2^20
163constructor SM90RefusalCopyOffsetOutOfRange
164-- a stall, wait mask or reuse mask wider than its control field
165constructor SM90RefusalControlOutOfRange
166-- a branch displacement that is not a whole number of 4-byte units
167constructor SM90RefusalBranchUnaligned
168-- a branch displacement outside the 58-bit field (or a backward branch of 0)
169constructor SM90RefusalBranchOutOfRange
170-- a word whose opcode is none of this family's
171constructor SM90RefusalUnknownOpcode
172-- a word with the opcode of a form whose other bits are not that form's
173-- a 64-bit global address register that is not an even pair below R254
174-- (Ra:Ra+1 holds the address; an odd Ra faults: the fill kernel's
175-- STG [R3.64] never retired on the H100, comparisons/h100-microbench run
176-- 20261017T114758Z)
177constructor SM90RefusalAddressUnaligned
178-- a 64- or 128-bit data register not aligned to its width (an even pair,
179-- a multiple-of-4 quad) or running past R254
180constructor SM90RefusalDataUnaligned
181constructor SM90RefusalSelectorOutOfRange
182constructor SM90RefusalNotCanonical
183end-family
184

The compiler supplied declaration spans and resolved links from this source snapshot. This page does not assert that this file belongs to a checked closure.