Back to @padstage

stage_rows_padstage

The stage kernel, with @padstage added, as the compiler built it for sm_75 at commit bbc8898: ; a grid of 1 CTAs, 256 threads each.

// Eight f16 rows of 256 bytes each, staged into shared memory. Under
// @padstage each row is padded by eight elements.
@padstage
kernel stage(K: tensor<f16>[64, 128], O: tensor<f16>[8, 128]) {
var k = K[0 :+ 8, 0 :+ 128]
O[0 :+ 8, 0 :+ 128] = k
}

phobos-lang/examples/stage_rows.ph@padstage added

The stage kernel with @padstage added, stepped through as the compiler built it for sm_75A 1 grid of CTAs with 256 threads each. The drawing shows the tensors K, O in global memory with the picked CTA's current boxes, shared memory as a byte ruler of 2176 bytes with each buffer at its planned offset, the barriers kept and elided, and how the CTA's threads and warp 0's lanes take part. The readout below describes each step.

CTA 0
  • global memory
  • shared memory
  • threads and lanes
  • extra 128-byte lines, masked elements

Keys: left and right arrows step, space plays and pauses; play runs on from the last step to the first. The address of this page keeps the step, the CTA and the zoom.