# The int8 shape ladder, re-timed per exl3 width.
#   shape_ladder_widths.py, eight one-width builds (I8_ONLY_BITS=K, I8_ONLY_CB=2)
#   merged.  THE WHOLE LADDER: every entry ext.SHAPES knows about, not a sample.
#   A two-row table cannot support a claim about which entries hold their block
#   count and which do not, and that claim is what this file exists to carry.
# cell = ptxas registers / dynamic SMEM bytes the launcher asks for / blocks per SM
#   registers: cudaFuncGetAttributes on the compiled kernel
#   blocks:    cudaOccupancyMaxActiveBlocksPerMultiprocessor -- the register
#              limit and the SMEM limit applied TOGETHER by the driver, which
#              is what a block count derived from the SMEM formula alone omits.
#   codebook:  mul1.  The two decodes do not cost the same registers, so this
#              table is about mul1 and says so rather than averaging them.
device: NVIDIA GeForce RTX 4090  sm_89  128 SMs  max dynamic SMEM/block 101376 B
fold_mode=0   widths=[1, 2, 3, 4, 5, 6, 7, 8]
shape tile                    thr |     K1 reg/smem/blk     K2 reg/smem/blk     K3 reg/smem/blk     K4 reg/smem/blk     K5 reg/smem/blk     K6 reg/smem/blk     K7 reg/smem/blk     K8 reg/smem/blk
    0 128x128x64 2x4 st3 sw1  256 |       125/ 27648/2        125/ 30720/2        124/ 33792/2        120/ 36864/2        128/ 39936/2        128/ 43008/2        128/ 46080/2        124/ 49152/2 
    1 256x128x64 2x4 st3 sw1  256 |       200/ 52224/1        200/ 55296/1        200/ 58368/1        169/ 61440/1        209/ 64512/1        209/ 67584/1        217/ 70656/1        204/ 73728/1 
    2 160x128x64 2x4 st3 sw1  256 |       128/ 33792/2        128/ 36864/2        128/ 39936/2        126/ 43008/2        157/ 46080/1        157/ 49152/1        161/ 52224/1        157/ 55296/1 
    3 64x128x64 2x4 st3 sw1   256 |        80/ 15360/3         79/ 18432/3         79/ 21504/3         80/ 24576/3         96/ 27648/2         96/ 30720/2         97/ 33792/2         80/ 36864/2 
    4 256x128x64 4x2 st3 sw1  256 |       200/ 52224/1        200/ 55296/1        200/ 58368/1        191/ 61440/1        216/ 64512/1        216/ 67584/1        221/ 70656/1        207/ 73728/1 
    5 128x256x64 2x4 st3 sw1  256 |       200/ 30720/1        196/ 36864/1        200/ 43008/1        193/ 49152/1        216/ 55296/1        216/ 61440/1        221/ 67584/1        207/ 73728/1 
    6 256x128x32 2x4 st4 sw1  256 |       202/ 34816/1        203/ 36864/1        203/ 38912/1        204/ 40960/1        204/ 43008/1        204/ 45056/1        205/ 47104/1        203/ 49152/1 
    7 128x128x128 2x4 st2 sw1  256 |       126/ 36864/2        126/ 40960/2        125/ 45056/2        123/ 49152/2        126/ 53248/1        126/ 57344/1        128/ 61440/1        121/ 65536/1 
    8 128x256x64 1x8 st3 sw1  256 |       200/ 30720/1        167/ 36864/1        200/ 43008/1        200/ 49152/1        209/ 55296/1        209/ 61440/1        217/ 67584/1        204/ 73728/1 
    9 64x256x64 1x8 st3 sw3   256 |       125/ 18432/2        121/ 24576/2        124/ 30720/2        121/ 36864/2        128/ 43008/2        128/ 49152/2        128/ 55296/1        124/ 61440/1 
   10 128x128x64 1x4 st3 sw1  128 |       200/ 27648/2        200/ 30720/2        200/ 33792/2        168/ 36864/2        209/ 39936/2        209/ 43008/2        217/ 46080/2        204/ 49152/2 
   11 128x256x64 1x8 st3 sw4  256 |       200/ 30720/1        167/ 36864/1        200/ 43008/1        200/ 49152/1        209/ 55296/1        209/ 61440/1        217/ 67584/1        204/ 73728/1 
   12 128x128x64 1x4 st3 sw8  128 |       200/ 27648/2        200/ 30720/2        200/ 33792/2        168/ 36864/2        209/ 39936/2        209/ 43008/2        217/ 46080/2        204/ 49152/2 
   13 256x256x64 1x8 st3 sw1  256 |       255/ 55296/1        255/ 61440/1        255/ 67584/1        255/ 73728/1        255/ 79872/1        255/ 86016/1        255/ 92160/1        255/ 98304/1 
   20 128x128x64 2x4 st3 sw4  256 |       125/ 27648/2        125/ 30720/2        124/ 33792/2        120/ 36864/2        128/ 39936/2        128/ 43008/2        128/ 46080/2        124/ 49152/2 
   21 128x128x64 2x4 st3 sw8  256 |       125/ 27648/2        125/ 30720/2        124/ 33792/2        120/ 36864/2        128/ 39936/2        128/ 43008/2        128/ 46080/2        124/ 49152/2 
   22 256x128x64 2x4 st3 sw4  256 |       200/ 52224/1        200/ 55296/1        200/ 58368/1        169/ 61440/1        209/ 64512/1        209/ 67584/1        217/ 70656/1        204/ 73728/1 
   23 256x128x64 2x4 st3 sw8  256 |       200/ 52224/1        200/ 55296/1        200/ 58368/1        169/ 61440/1        209/ 64512/1        209/ 67584/1        217/ 70656/1        204/ 73728/1 
   24 128x128x128 2x4 st2 sw8  256 |       126/ 36864/2        126/ 40960/2        125/ 45056/2        123/ 49152/2        126/ 53248/1        126/ 57344/1        128/ 61440/1        121/ 65536/1 
   25 256x128x64 2x4 st3 sw16  256 |       200/ 52224/1        200/ 55296/1        200/ 58368/1        169/ 61440/1        209/ 64512/1        209/ 67584/1        217/ 70656/1        204/ 73728/1 
   26 128x128x128 2x4 st2 sw4  256 |       126/ 36864/2        126/ 40960/2        125/ 45056/2        123/ 49152/2        126/ 53248/1        126/ 57344/1        128/ 61440/1        121/ 65536/1 
   27 128x128x128 1x4 st2 sw8  128 |       200/ 36864/2        200/ 40960/2        201/ 45056/2        199/ 49152/2        209/ 53248/1        209/ 57344/1        215/ 61440/1        199/ 65536/1 
   30 128x128x64 1x4 st2 sw8  128 |       200/ 18432/2        200/ 20480/2        201/ 22528/2        168/ 24576/3        209/ 26624/2        209/ 28672/2        217/ 30720/2        204/ 32768/2 
   31 128x64x64 1x4 st2 sw8   128 |       124/ 17408/4        124/ 18432/4        124/ 19456/4        126/ 20480/4        126/ 21504/4        126/ 22528/4        126/ 23552/4        126/ 24576/4 
   32 128x128x64 1x8 st2 sw8  256 |       122/ 18432/2        122/ 20480/2        124/ 22528/2        122/ 24576/2        125/ 26624/2        125/ 28672/2        126/ 30720/2        124/ 32768/2 
   33 128x128x64 1x4 st3 sw8  128 |       200/ 27648/2        200/ 30720/2        200/ 33792/2        168/ 36864/2        209/ 39936/2        209/ 43008/2        217/ 46080/2        204/ 49152/2 
   34 64x128x64 1x4 st2 sw8   128 |       125/ 10240/4        125/ 12288/4        125/ 14336/4        121/ 16384/4        126/ 18432/4        126/ 20480/4        128/ 22528/4        126/ 24576/4 
   35 256x64x32 1x4 st3 sw8   128 |       229/ 25344/2        230/ 26112/2        230/ 26880/2        232/ 27648/2        230/ 28416/2        230/ 29184/2        232/ 29952/2        229/ 30720/2 
   36 256x64x64 1x4 st2 sw8   128 |       224/ 33792/2        224/ 34816/2        233/ 35840/2        224/ 36864/2        228/ 37888/2        228/ 38912/2        232/ 39936/2        168/ 40960/2 
   37 128x64x64 1x4 st3 sw8   128 |       126/ 26112/3        126/ 27648/3        126/ 29184/3        126/ 30720/3        126/ 32256/3        126/ 33792/2        126/ 35328/2        125/ 36864/2 
   40 128x128x128 1x4 st2 sw8  128 |       198/ 36864/2        198/ 40960/2        200/ 45056/2        198/ 49152/2        209/ 53248/1        209/ 57344/1        216/ 61440/1        191/ 65536/1 
   41 256x64x64 1x4 st2 sw8   128 |       225/ 33792/2        225/ 34816/2        227/ 35840/2        224/ 36864/2        228/ 37888/2        228/ 38912/2        232/ 39936/2        167/ 40960/2 
   42 128x128x64 1x8 st2 sw8  256 |       126/ 18432/2        126/ 20480/2        124/ 22528/2        123/ 24576/2        126/ 26624/2        126/ 28672/2        128/ 30720/2        124/ 32768/2 
   50 128x128x128 1x4 st2 sw8  128 |       200/ 36864/2        200/ 40960/2        201/ 45056/2        199/ 49152/2        209/ 53248/1        209/ 57344/1        215/ 61440/1        199/ 65536/1 
   51 128x128x64 1x4 st2 sw8  128 |       200/ 18432/2        200/ 20480/2        201/ 22528/2        168/ 24576/3        209/ 26624/2        209/ 28672/2        217/ 30720/2        204/ 32768/2 
   52 128x128x64 1x8 st2 sw8  256 |       122/ 18432/2        122/ 20480/2        124/ 22528/2        121/ 24576/2        125/ 26624/2        125/ 28672/2        126/ 30720/2        124/ 32768/2 
   53 128x128x128 1x4 st3 sw8  128 |       200/ 55296/1        200/ 61440/1        205/ 67584/1        199/ 73728/1        209/ 79872/1        209/ 86016/1        217/ 92160/1        199/ 98304/1 
   54 128x128x64 1x4 st3 sw8  128 |       200/ 27648/2        200/ 30720/2        200/ 33792/2        168/ 36864/2        209/ 39936/2        209/ 43008/2        217/ 46080/2        204/ 49152/2 
   60 128x128x128 1x4 st2 sw8  128 |       200/ 36864/2        200/ 40960/2        201/ 45056/2        199/ 49152/2        209/ 53248/1        209/ 57344/1        215/ 61440/1        199/ 65536/1 
   61 128x128x64 1x4 st2 sw8  128 |       200/ 18432/2        200/ 20480/2        201/ 22528/2        168/ 24576/3        209/ 26624/2        209/ 28672/2        217/ 30720/2        204/ 32768/2 
   62 128x128x64 1x4 st3 sw8  128 |       200/ 27648/2        200/ 30720/2        200/ 33792/2        168/ 36864/2        209/ 39936/2        209/ 43008/2        217/ 46080/2        204/ 49152/2 
   63 128x128x64 1x8 st2 sw8  256 |       122/ 18432/2        122/ 20480/2        124/ 22528/2        122/ 24576/2        125/ 26624/2        125/ 28672/2        126/ 30720/2        124/ 32768/2 
   64 128x128x128 1x4 st2 sw8  128 |       202/ 36864/2        202/ 40960/2        205/ 45056/2        201/ 49152/2        211/ 53248/1        211/ 57344/1        225/ 61440/1        192/ 65536/1 
   65 128x128x64 1x4 st2 sw8  128 |       202/ 18432/2        202/ 20480/2        205/ 22528/2        168/ 24576/3        206/ 26624/2        206/ 28672/2        210/ 30720/2        202/ 32768/2 
   66 128x128x64 1x4 st3 sw8  128 |       202/ 27648/2        202/ 30720/2        205/ 33792/2        166/ 36864/2        204/ 39936/2        204/ 43008/2        210/ 46080/2        202/ 49152/2 
   67 128x128x128 1x4 st2 sw8  128 |       200/ 36864/2        200/ 40960/2        201/ 45056/2        199/ 49152/2        212/ 53248/1        212/ 57344/1        216/ 61440/1        199/ 65536/1 
   68 128x128x64 1x4 st2 sw8  128 |       200/ 18432/2        200/ 20480/2        201/ 22528/2        168/ 24576/3        208/ 26624/2        208/ 28672/2        212/ 30720/2        204/ 32768/2 
   70 128x128x128 1x4 st2 sw8  128 |       202/ 36864/2        202/ 40960/2        205/ 45056/2        201/ 49152/2        211/ 53248/1        211/ 57344/1        217/ 61440/1        192/ 65536/1 
   71 128x128x64 1x4 st2 sw8  128 |       202/ 18432/2        202/ 20480/2        205/ 22528/2        168/ 24576/3        210/ 26624/2        210/ 28672/2        227/ 30720/2        206/ 32768/2 
   72 128x128x64 1x4 st3 sw8  128 |       202/ 27648/2        202/ 30720/2        205/ 33792/2        166/ 36864/2        210/ 39936/2        210/ 43008/2        227/ 46080/2        206/ 49152/2 
   73 128x128x64 1x8 st2 sw8  256 |       124/ 18432/2        124/ 20480/2        124/ 22528/2        121/ 24576/2        125/ 26624/2        125/ 28672/2        127/ 30720/2        125/ 32768/2 

  where occupancy steps down from its K=4 value:
    s2   160x128x64 2x4 st3 sw1 2 blocks at K=4 -> 1 from K=5
    s3   64x128x64 2x4 st3 sw1  3 blocks at K=4 -> 2 from K=5
    s7   128x128x128 2x4 st2 sw1 2 blocks at K=4 -> 1 from K=5
    s9   64x256x64 1x8 st3 sw3  2 blocks at K=4 -> 1 from K=7
    s24  128x128x128 2x4 st2 sw8 2 blocks at K=4 -> 1 from K=5
    s26  128x128x128 2x4 st2 sw4 2 blocks at K=4 -> 1 from K=5
    s27  128x128x128 1x4 st2 sw8 2 blocks at K=4 -> 1 from K=5
    s30  128x128x64 1x4 st2 sw8 3 blocks at K=4 -> 2 from K=1
    s37  128x64x64 1x4 st3 sw8  3 blocks at K=4 -> 2 from K=6
    s40  128x128x128 1x4 st2 sw8 2 blocks at K=4 -> 1 from K=5
    s50  128x128x128 1x4 st2 sw8 2 blocks at K=4 -> 1 from K=5
    s51  128x128x64 1x4 st2 sw8 3 blocks at K=4 -> 2 from K=1
    s60  128x128x128 1x4 st2 sw8 2 blocks at K=4 -> 1 from K=5
    s61  128x128x64 1x4 st2 sw8 3 blocks at K=4 -> 2 from K=1
    s64  128x128x128 1x4 st2 sw8 2 blocks at K=4 -> 1 from K=5
    s65  128x128x64 1x4 st2 sw8 3 blocks at K=4 -> 2 from K=1
    s67  128x128x128 1x4 st2 sw8 2 blocks at K=4 -> 1 from K=5
    s68  128x128x64 1x4 st2 sw8 3 blocks at K=4 -> 2 from K=1
    s70  128x128x128 1x4 st2 sw8 2 blocks at K=4 -> 1 from K=5
    s71  128x128x64 1x4 st2 sw8 3 blocks at K=4 -> 2 from K=1

# READING THIS TABLE
#
# 8 bpw fits.  The largest request on the ladder is 98304 B (s13 and s53 at
# K=8) against this card's 101376 B per-block cap.  No width is dropped for
# capacity, and no entry reports OVER-SMEM at any width.
#
# The step is at K=5, and it is SHAPE-dependent, which is why a ladder
# inherited from K=4 is wrong in a shape-dependent way:
#   * the 128-deep 2-stage family (s7/s24/s26/s27 and the 40/50/60/64/67/70
#     twins) goes 2 blocks -> 1 at K=5;
#   * s2 and s3 step at K=5 as well, s37 at K=6, s9 at K=7;
#   * the 2-stage 64-deep entries (s31/s32/s34/s52/s63/s73, and s35/s36) hold
#     their K=4 block count at every width, K=5 and K=6 included.
#
# s30 and its twins (51/61/65/68/71) are the entry that only a REGISTER
# measurement can read correctly.  They show 3 blocks at K=4 and 2 at every
# other width -- INCLUDING K=1, 2 and 3, where the SMEM request is SMALLER
# than at K=4.  It is not a K-monotone SMEM effect at all: ptxas gives the
# K=4 instantiation 168 registers and the others 200-217, and 168 x 128
# threads = 21504 leaves room for a third block where 200 x 128 = 25600 does
# not.  A block count derived from the SMEM formula alone would have reported
# s30 holding at 3 across the board, and s30 is the entry #1861's pin ladder
# favours.
