vyrn

std/tile

2 exports, from std/tile.vyrn.

Integer matrix tiles: mmaInt8 and mmaUInt8, the CPU oracle a GPU tile must equal bit for bit.

Each adds a 16 by 32 A tile of 8-bit integers times a 32 by 16 B tile to a 16 by 16 Int32 accumulator. Every tile is row-major, and the sums wrap as Int32 arithmetic does, never saturating, so integer addition modulo 2^32 leaves no order to differ in. acc plus a times b, each element widened by wide: element (i, j) is acc[16i + j] plus the sum over k below 32 of a[32i + k] * b[16k + j].

Dependencies

The import graph shows the whole library.

Imports
Imported by
fn mmaInt8(a: read Array<Int8, 512>, b: read Array<Int8, 512>, acc: Array<Int32, 256>) -> Array<Int32, 256>

acc plus a times b for Int8 tiles: A is 16 by 32, B 32 by 16 and acc 16 by 16, row-major. The sums wrap.

fn mmaUInt8(a: read Array<UInt8, 512>, b: read Array<UInt8, 512>, acc: Array<Int32, 256>) -> Array<Int32, 256>

acc plus a times b for UInt8 tiles, shaped as for mmaInt8. The sums wrap.

Tests

4 test blocks in std/tile.vyrn. CI runs all of them.

Test names
  • a hand tile adds its two products where they meet
  • a sum wraps at both Int32 limits
  • all-127 and all -128 tiles reach the largest sums
  • the probe's tiles give the bits NVIDIA's tensor cores gave

Examples

    No example program imports this module.