Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

SASS Encoding Dispatch & Format Tables

Addresses apply to ptxas v13.0.88 (CUDA 13.0). VA base 0x400000 (non-PIE).

Browsable data dump for the SASS encoder and its function-pointer dispatch tables. Every value here is read directly from the binary's .rodata; the consuming code is documented on the encoder pages.

Encoder Dispatch Layers

The encoder routes one logical instruction through four function-pointer layers plus a scalar opcode→slot table, all drawing handlers from one shared pool. The per-SM array is the authoritative per-architecture override.

LayerRegion VAIndexing schemeKeyed byDistinct handlersNote
opcode_to_encoding0x22B4B60flat u16[222]opcode indexopcode → encoding slot (sentinel 355)
encoding_tree_10x233BE000x2353E0016-byte slotted tree (274 internal / 5,169 leaf)(format_id<<8)|minor4,618primary format + handler selection
encoding_tree_20x235CE000x2379E0016-byte slotted tree (427 internal / 6,251 leaf)(format_id<<8)|minorsecondary/extended tree (shares pool)
sass_handler_dispatch_10x22C0E000x22F1E00(opcode, category, variant) sub-tablesopcode id6,915superset emit-handler list
sass_handler_dispatch_20x2379E000x2399E00(opcode, category, variant) sub-tablesopcode id3,478strict subset of _1
per_sm_handler_dispatch0x22E7AD00x23B99D05 × {u64 op, u64 ptr, u64 pad} arrays(format_id<<8)|minor2,421per-arch override (sm50_7x / sm75 / sm100 / sm80_8x / sm86_89)
isel_vtable (off_22AD230, off_23B3A80)0x22AD230, 0x23B3A80C++ vtablesvirtual slot3,707ISel node vtables — NOT encoder dispatch
encoder_handler_union8,874union of tree + sass1 + sass2 + per_sm

Reconciliation matrix (handlers shared between layers)

Layerencoding_treesass_dispatch_1sass_dispatch_2per_sm_dispatchisel_vtable
encoding_tree4,6182,8283,3672,1940
sass_dispatch_12,8286,9152,8321,7110
sass_dispatch_23,3672,8323,4781,8990
per_sm_dispatch2,1941,7111,8992,4210
isel_vtable00003,707

The isel_vtable row/column is zero against every encoder layer: the two C++ vtables share no handler with any genuine encoder dispatch, which is the proof that they are ISel node vtables, not an alternate encoder path.

Encoding-tree geometry (16-byte slots)

TreeWindowslots in windowinternalleafreserved tail
encoding_tree_10x233BE000x2353E006,1442745,169701
encoding_tree_20x235CE000x2379E007,4244276,251746
total13,56870111,4201,447

Leaf flavors (across 11,420 leaves): key_handler 4,117 ({dispatch_key, handler}; 396 distinct keys, 2,542 distinct handlers), handler_value 3,635 ({handler, extra}), null_or_data 3,668 (inline data or terminator).

Opcode → encoding slot — sentinel-355 opcodes

opcode_to_encoding (u16[222]) carries 117 non-zero non-sentinel slots, 95 zeros, and 10 sentinel-355 entries. Sentinel 355 means "extended / macro-lowered — no default encoding, requires the ISel resolver's SM-specific vtable override":

OpcodeMnemonicOpcodeMnemonic
40FCHK213CREATEPOLICY
49FRND214CVTA
169S2UR215DMMA
212CGAERRBAR216ELECT
219FENCE_S
220FMNMX

Format Descriptors (38 entries)

Each format descriptor is a 136-byte .rodata record at 0x23F1D70+. The xmmword header is loaded into the encoding context at a1+8; the trailing slot arrays define operand geometry. format_id is the value emitted at bits[25:31]; width_bits is the instruction word width; slot_sizes/slot_types/slot_flags are the per-slot geometry.

#VALabelformat_idwidthslotsslot_sizesslot_typesslot_flagsencoders
00x23F1D7064b_B46418070
10x23F1DF8128b_0x038128210,17280,3202
20x23F1E80128b_0x09_idx2912828,17280,40
30x23F1F0864b_A3641100215
40x23F1F9064b_C2641812020
50x23F2018128b_0x076128210,17240,326
60x23F20A0128b_0x04_idx64128210,17200,30
70x23F2128128b_0x09712828,17240,42
80x23F21B0128b_0x0A10128210,170,3135
90x23F223864b_D26411014017
100x23F22C0128b_0x09_idx10912828,17280,40
110x23F2348128b_0x0D8128210,17280,311
120x23F23D0128b_0x0B_idx121112828,170,40
130x23F2458128b_0x08_idx13812828,17260,40
140x23F24E064b_0x03_idx14364161200
150x23F2568128b_0x08_idx158128212,17300,20
160x23F25F0128b_0x129128210,17300,321
170x23F2678128b_0x139128212,170,2143
180x23F2700128b_0x0B_idx181112826,17300,50
190x23F278864b_0x05_idx195641600
200x23F2810128b_0x167128210,17260,36
210x23F2898128b_0x05_idx215128212,17240,20
220x23F2920128b_0x05_idx22512828,17200,40
230x23F29A8128b_0x197128212,17280,2152
240x23F2A30128b_0x06_idx246128212,17260,20
250x23F2AB8128b_0x0D_idx2513128312,17,33420,2,90
260x23F2B40128b_0x0E_idx261412838,17,33400,4,110
270x23F2BC8128b_0x07_idx27712828,17240,40
280x23F2C5064b_E1641101201
290x23F2CD8128b_0x10_idx291612838,17,3344,52,68,84,100,1160,4,110
300x23F2D6064b_0x04_idx30464161400
310x23F2DE8128b_0x216128210,17240,32
320x23F2E7064b_0x02_idx3226411200
330x23F2EF8128b_0x237128212,17280,29
340x23F2F80128b_0x07_idx347128214,17300,10
350x23F3008128b_0x08_idx358128214,170,10
360x23F3090128b_0x0C_idx3612128314,17,33420,1,80
370x23F3118128b_0x0D_idx3713128310,17,33400,3,100

Universal slot template (0x23F1C60, refcount 7,302 — the most-shared slot-size template): sizes [3, 2, 4, 6, 8]. Slot-size values 10/12 = register, 17 = immediate/cbuf, 33 = wide third slot, -1 = unused. Slot-type 28 = register-type, 12/14 = alt, -1 = unused. Slot-flag 0 = default, 2/3/4 = secondary/uniform-extended class, -1 = unused.

Modifier Value Tables (40 arrays)

Forty .rodata arrays at 0x22FCD200x22FD580 (2,144 bytes total) that map an Ori-modifier enum value to a SASS field value. The lookup is TABLE[ir_val - BASE]; a -1 entry is an illegal/reserved slot (the encoder propagates -1 as an encoding error). 11 are identity maps, 4 are byte-width (wide enum spaces up to 256), 3 contain -1 gap entries.

VALabeltypecountidentitygapsvalues
0x22FCD20rounding_mode_023dword3nono0,2,3
0x22FCD30gap_table_neg1dword5noyes0,-1,2,3,4
0x22FCD50gap_table_dual_neg1dword6noyes0,-1,1,-1,2,3
0x22FCD70swap_01dword4nono1,0,2,3
0x22FCD80gap_no_3dword4nono0,1,2,4
0x22FCD90fold_last_twodword4nono0,1,2,2
0x22FCDA0large_jump_9_to_12dword19nono0,1,2,3,4,5,6,7,8,12,13,14,15,17,18,19,20,21,22
0x22FCDF4fold_3_3dword4nono1,2,3,3
0x22FCE1Ccomplex_remapping_15dword15noyes0,10,11,17,19,20,-1,25,26,28,42,35,12,33,34
0x22FCE60alt_remapping_11dword11nono10,11,17,19,20,21,25,26,28,34,35
0x22FCEA4pair_fold_groupdword18nono0,1,1,2,3,4,5,0,1,2,3,4,5,7,8,10,11,12
0x22FCEF4identity_4adword4yesno0,1,2,3
0x22FCF10compound_remap_13dword13nono0,1,0,1,6,7,8,17,18,19,20,21,22
0x22FCF50offset_2_to_6dword6nono0,2,3,4,5,6
0x22FCF70rotationdword5nono1,2,3,0,4
0x22FCF90fold_0_1_1_2_2dword5nono0,1,1,2,2
0x22FCFACpair_1_3dword2nono1,3
0x22FCFC4fold_2_dupdword9nono0,1,2,2,3,4,5,6,7
0x22FCFF0split_blockdword9nono0,1,2,4,5,0,3,4,5
0x22FD020identity_byte_64byte64yes0..63
0x22FD060stride_skip_byte_36byte36no0,1,3,4,6,7,9,10,…,52 (skip every 3rd)
0x22FD0A0identity_byte_96byte96yes0..95
0x22FD100small_identity_8dword8yesno0..7
0x22FD150skip_4dword6nono0,1,2,3,5,6
0x22FD170skip_1_3dword5nono0,2,4,5,6
0x22FD18Cstride_9_then_1_4dword9nono0,9,18,27,36,1,2,3,4
0x22FD1B8fold_1_2_2_3_4dword5nono1,2,2,3,4
0x22FD1E0jump_5_to_9dword13nono0,1,2,3,4,5,9,10,11,12,13,14,15
0x22FD220identity_byte_256byte256yes0..255
0x22FD320power_encoding_1_3_15dword3nono1,3,15
0x22FD354identity_7_plus_3dword10nono1,2,3,4,5,6,0,1,2,3
0x22FD384identity_22dword22nono1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,0,1,2,3,4,5,7
0x22FD3E4identity_17_rotateddword17nono1..11,0,1,2,3,4,5
0x22FD440identity_8_dup_taildword13nono0,1,2,3,4,5,6,7,2,3,4,5,6
0x22FD480identity_5dword5yesno0..4
0x22FD498tristatedword3yesno0,1,2
0x22FD4C0identity_11dword11yesno0..10
0x22FD500identity_9dword9yesno0..8
0x22FD540identity_10dword10yesno0..9
0x22FD570quaternarydword4yesno0,1,2,3

Tier-2 Per-Architecture Modifier Defaults

The Tier-2 modifier table (loaded into the encoding context at a1+404) selects per-SM encoding variations for the same Tier-1 format layout. The groups cluster by SM generation; each 16-byte slot is two {lo, hi} packed words.

GroupVASM rangedwords (per slot, abbreviated)
group_A_maxwell_turing0x202A280sm_50–sm_7512 slots; {0,1,1,1},{2,1,3,1},{0,1,2,1},{3,1,4,1},{0,2,2,2},{4,2,6,2}, then -1-terminated pairs
group_B_ampere_ada0x22F1B30sm_80–sm_89{0,2,1,1},{0,1,1,2},{2,1,3,2}
group_D_lovelace_hopper0x22F1BA0sm_89–sm_90{1,1,3,1},{0,2,2,1}
group_E_blackwell_dc0x22F1AA0sm_100–sm_103{0,2,1,2},{4,1,5,1},{0,2,3,2},{4,2,5,2}
group_F_blackwell_consumer0x22F1C20sm_120–sm_121{0,4,1,4},{2,4,3,4}
group_G_cross_arch0x23B2DE0cross-architecture{0,1,1,4}

The 4 appearing in the high word of every group_F slot is the consumer-Blackwell encoding-class tag; group_A uses 1/2, matching the Maxwell–Turing two-class split. These constants are the per-SM setBits triples that make the per-SM handler arrays byte-distinct while sharing the same handler bodies.

Cross-References