Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mv/blob/main/src/omega_gpu_tgemm_api.h # omega-mv Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance. Brought by drakestapleton Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / src / omega_gpu_tgemm_api.h` 48 lines ยท 3054 bytes Raw Blame History 1 #ifndef OMEGA_GPU_TGEMM_API_H 2 #define OMEGA_GPU_TGEMM_API_H 3 /* 4 * omega_gpu_tgemm_api: the trainer's device-resident bf16 GEMM (lane E1, 2026-10-16). New file. 5 * C[m][n] f32 = A[m][k] bf16 x B[k][n] bf16, all three row-major and already resident on the GPU (no host pack per call). 6 * Kernels: omega_blackwell_codegen_tgemm.h, cached through the prefill module's resident-kernel cache (omega_gpu_prefill.h, 7 * kind OMEGA_TGEMM_KIND). Return codes are the prefill module's (OMEGA_GPU_PF_OK, _BAD_ARGS, _TOO_LARGE, _CHIP_FAIL). 8 * Memory rule (trainer plan R-8): buffers from omega_gpu_pf_alloc_dev are GPU-cached and must never be read or written by the 9 * CPU; the tile table is a host (uncached) buffer the CPU fills and the session syncs. 10 * Limits: m a multiple of the tile height (omega_gpu_tgemm_bm), n a multiple of the span (warps * 16), k a multiple of 128, 11 * m / bm <= 65535 tiles, m * n < 2^32 (32-bit row arithmetic in the kernel). omega_gpu_tgemm serializes on the session lock; the 12 * module's tile table is rebuilt under it. 13 */ 14 #include 15 #include "omega_gpu_session.h" 16 #include "omega_blackwell_codegen_tgemm.h" 17 18 #ifdef __cplusplus 19 extern "C" { 20 #endif 21 #define OMEGA_TGEMM_KIND 0x60u 22 typedef struct { 23 uint32_t layout; /* OMEGA_TGEMM_LAYOUT_* */ 24 uint32_t epi; /* OMEGA_TGEMM_EPI_* */ 25 uint32_t m, n, k; 26 uint64_t a_va, b_va, c_va; 27 } OmegaTgemmCall; 28 typedef struct { uint64_t c_va; uint32_t row0, kb0, nkb, pad; uint64_t pad2; } OmegaTgemmTile; 29 30 /* the kernel spec the current knobs pick for a call (BAD_ARGS when the call cannot be served) */ 31 int omega_gpu_tgemm_spec(const OmegaTgemmCall *c, OmegaTgemmSpec *out); 32 uint32_t omega_gpu_tgemm_bm(uint32_t n); /* rows per tile the current knobs pick for width n (what m must be a multiple of) */ 33 /* tile table for a call: one entry per bm rows; returns the count (0: refused or more than max) */ 34 uint32_t omega_gpu_tgemm_tiles(const OmegaTgemmCall *c, OmegaTgemmTile *tab, uint32_t max); 35 /* synchronous: builds the table in a module-owned host buffer, launches, waits; chip ns added to *ns when given */ 36 int omega_gpu_tgemm(const OmegaTgemmCall *c, uint64_t *ns); 37 /* non-blocking: lock held and device open (omega_gpu_pf_open_locked); fills *L for omega_gpu_cmdlist_add with the resident 38 * kernel, the grid and args[OMEGA_TGEMM_ARGS_WORDS] (the caller's array; L->args points at it, so it must outlive the add). 39 * tiles_va: a GPU-visible table of ntiles entries already synced. Caller-built entries must have nkb >= 1 (the kernel's block 40 * counter is unsigned: nkb 0 would run until the timeout) and kb0 * 128 * n < 2^32 (32-bit row arithmetic). */ 41 int omega_gpu_tgemm_fill_launch_locked(const OmegaTgemmCall *c, uint64_t tiles_va, uint32_t ntiles, OmegaGpuLaunch *L, uint32_t *args); 42 /* knobs: rt (2/4/8), warps (8/16), aqn (1/2); 0 keeps the default (rt 4, warps 16, aqn 1; warps 8 when n % 256 != 0) */ 43 void omega_gpu_tgemm_set_shape(uint32_t rt, uint32_t warps, uint32_t aqn); 44 void omega_gpu_tgemm_test_set_mutant(int m); 45 #ifdef __cplusplus 46 } 47 #endif 48 #endif