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/CUDApp/blob/main/src/omega_gpu_tgemm_api.h # CUDApp CUDA++: AIEN’s GPU machine-code toolchain, runtime and driver client for NVIDIA GPUs without the CUDA toolkit. Hardware coverage and driver replacement limits are explicit. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `CUDApp / src / omega_gpu_tgemm_api.h` 49 lines · 3116 bytes Raw Blame History 1 /* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception */ 2 #ifndef OMEGA_GPU_TGEMM_API_H 3 #define OMEGA_GPU_TGEMM_API_H 4 /* 5 * omega_gpu_tgemm_api: the trainer's device-resident bf16 GEMM (lane E1, 2026-10-16). New file. 6 * 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). 7 * Kernels: omega_blackwell_codegen_tgemm.h, cached through the prefill module's resident-kernel cache (omega_gpu_prefill.h, 8 * kind OMEGA_TGEMM_KIND). Return codes are the prefill module's (OMEGA_GPU_PF_OK, _BAD_ARGS, _TOO_LARGE, _CHIP_FAIL). 9 * 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 10 * CPU; the tile table is a host (uncached) buffer the CPU fills and the session syncs. 11 * 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, 12 * m / bm <= 65535 tiles, m * n < 2^32 (32-bit row arithmetic in the kernel). omega_gpu_tgemm serializes on the session lock; the 13 * module's tile table is rebuilt under it. 14 */ 15 #include 16 #include "omega_gpu_session.h" 17 #include "omega_blackwell_codegen_tgemm.h" 18 19 #ifdef __cplusplus 20 extern "C" { 21 #endif 22 #define OMEGA_TGEMM_KIND 0x60u 23 typedef struct { 24 uint32_t layout; /* OMEGA_TGEMM_LAYOUT_* */ 25 uint32_t epi; /* OMEGA_TGEMM_EPI_* */ 26 uint32_t m, n, k; 27 uint64_t a_va, b_va, c_va; 28 } OmegaTgemmCall; 29 typedef struct { uint64_t c_va; uint32_t row0, kb0, nkb, pad; uint64_t pad2; } OmegaTgemmTile; 30 31 /* the kernel spec the current knobs pick for a call (BAD_ARGS when the call cannot be served) */ 32 int omega_gpu_tgemm_spec(const OmegaTgemmCall *c, OmegaTgemmSpec *out); 33 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) */ 34 /* tile table for a call: one entry per bm rows; returns the count (0: refused or more than max) */ 35 uint32_t omega_gpu_tgemm_tiles(const OmegaTgemmCall *c, OmegaTgemmTile *tab, uint32_t max); 36 /* synchronous: builds the table in a module-owned host buffer, launches, waits; chip ns added to *ns when given */ 37 int omega_gpu_tgemm(const OmegaTgemmCall *c, uint64_t *ns); 38 /* non-blocking: lock held and device open (omega_gpu_pf_open_locked); fills *L for omega_gpu_cmdlist_add with the resident 39 * kernel, the grid and args[OMEGA_TGEMM_ARGS_WORDS] (the caller's array; L->args points at it, so it must outlive the add). 40 * tiles_va: a GPU-visible table of ntiles entries already synced. Caller-built entries must have nkb >= 1 (the kernel's block 41 * counter is unsigned: nkb 0 would run until the timeout) and kb0 * 128 * n < 2^32 (32-bit row arithmetic). */ 42 int omega_gpu_tgemm_fill_launch_locked(const OmegaTgemmCall *c, uint64_t tiles_va, uint32_t ntiles, OmegaGpuLaunch *L, uint32_t *args); 43 /* 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) */ 44 void omega_gpu_tgemm_set_shape(uint32_t rt, uint32_t warps, uint32_t aqn); 45 void omega_gpu_tgemm_test_set_mutant(int m); 46 #ifdef __cplusplus 47 } 48 #endif 49 #endif