halocline

The dive · Kernels

The sm_89 hot paths

One card's kernels, taken one at a time, each checked bit for bit before it counts.

Halocline's decode runs on fused kernels written for one architecture. This page follows the kernels that brought Qwen4-35B-A3B onto those paths: what each one changed, what proves it changed nothing else, and which shapes and types each fused kernel takes, read from the source lines that decide it.

  • Hyper-connection read5.88%
  • Heads and draft vocabulary15.61%
  • Both26.86%
  • Parity checks7

One kernel at a time

The same engine, pack (UD-Q6_K_XL), flags and fixtures; each arm adds one change, so each step's gain belongs to that kernel. Gains are on the conversation fixture against the first arm.

ArmWhat it addsDraft vocabularyConversationStructuredProse
mainnothing: the A3B on the generic hyper-connection read and headno176.0eval212.4eval161.5eval
hc readthe fused hyper-connection read (hc_read_ada) at n_embd 2048, rank 256no186.3eval232.2eval179.0eval
headsthe Q8_0 bit-plane verify head and the 2-bit draft proxy at width 2048, with --draft-vocab n32768yes203.4eval249.6eval195.8eval
allboth, mergedyes223.2eval273.3eval205.2eval

The Qwen4-35B-A3B pack carries no draft vocabulary, so the drafter scored every row of the head on every draft step until the vocabulary option reached this model. The head arm's gain is mostly that.

Where the time goes

The mean time of one verify pass by the number of tokens it checks (the first token pays the whole pass, each token after it costs the slope), then the whole window with its draft step, on the conversation fixture.

ArmVerify, one tokenTwoThreeWhole window, draft and verifyTokens a window
main6.7 mseval8.6 mseval10.3 mseval11.4 mseval2.02eval
hc read6.2 mseval7.8 mseval9.4 mseval10.7 mseval2.00eval
heads6.7 mseval8.5 mseval10.2 mseval9.8 mseval2.01eval
all6.1 mseval7.7 mseval9.3 mseval9.0 mseval2.02eval

The hyper-connection read takes time off every window, because every layer reads twice per token. The head change barely moves the verify pass and leaves the tokens per window where they were; it cuts the draft step, which no longer scores the whole head, so the whole window gets shorter.

Parity before speed

A kernel counts only when its output matches the code it replaces. Each test runs at both shapes the engine serves.

TestShapeResult
hc_read_ada_parity 3n_embd 2560, rank 320bitwiseeval
hc_read_ada_parity 3 --a3bn_embd 2048, rank 256bitwiseeval
q80_vhead_parity 248320 3head width 2560OKeval
q80_vhead_parity 248320 3 --a3bhead width 2048OKeval
q80_proxy_parity 100000 200head width 2560OKeval
q80_proxy_parity 100000 200 --a3bhead width 2048OKeval
hc8_up_b16_parityboth widthspasseval

The fused hyper-connection read runs 128eval blocks of 512eval threads, one per multiprocessor, with 51,200eval bytes of shared memory for the shortest windows. Its parity test compares it with the three kernels it replaces at every window size and finds no differing byte.

Which kernel takes what

Each fact below is the source line that decides it, so the page changes when the code does.

KernelTakes
Fused mid-layer chain (GDN layers)projection type ids 8, 8, 8 or 14, 14, 14 (all eight-bit or all six-bit K-quant); any other mix runs the unfused sequence
Grouped expert glueexpert width 640 only; other widths run the device-planned tail without it
Expert tail, six-bit down projectiongate/up and down pairs X(12, 14) X(13, 14) X(14, 14)
Dense tensor-core projectioninteger tensor cores, m16n8k32.row.col.s32.s8.s8.s32
The BF16 tensor-core optionm16n8k16.row.col.f32.bf16.bf16.f32, after rounding the activations

The mid chain's type rule is why UD-Q8_K_XL, whose projections are all BF16, runs its GDN layers unfused today. A BF16 chain on full-precision activations is the open kernel for that tier.

The BF16 product

Window time by token count for the six-bit tier, the eight-bit tier on its default product, and the eight-bit tier on tensor cores.

ArmOne tokenTwoThree
UD-Q6_K_XL6.1 mseval7.7 mseval9.3 mseval
UD-Q8_K_XL8.3 mseval10.4 mseval12.3 mseval
UD-Q8_K_XL, tensor cores10.6 mseval12.3 mseval14.0 mseval

The eight-bit tier's extra time at one token is its BF16 weights' bytes, read once per pass. The tensor-core product adds time at every window size: these products wait on memory, so rounding the activations buys nothing here.