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/tests/gpu_tgemm_test.c # 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 / tests / gpu_tgemm_test.c` 271 lines ยท 18370 bytes Raw Blame History 1 /* gpu_tgemm_test.c (trainer lane E1, 2026-10-16): device-resident bf16 training GEMM (omega_blackwell_codegen_tgemm.h, 2 * omega_gpu_tgemm_api.h). C[M][N] f32 = A[M][K] bf16 x B[K][N] bf16, row-major, NN. 3 * --host-only budgets of the production specs: instructions, allocator peak and declared registers (refused past 1000 / 128) 4 * --sim the kernel in the warp simulator (both fragment orders) bit-identical to the C emulation of the HMMA chain 5 * (tests/bw_hmma_model.h, GB10 member) over the whole output, tile K ranges (kb0, nkb), mutants 1-4 caught 6 * --chip (caller holds the GB10 quiet lock) every output against a double reference over the same bf16-rounded inputs 7 * (|got - ref| / max(sum |terms|, 1e-6) < 1e-5: the rule of gpu_matmul_api_test.c), first with uncached (host) 8 * buffers, then with GPU-cached device buffers (trainer rule R-8); bit-identical repeats, poison scan (every output 9 * written), negative control (mutant 4 differs), medians of chip time and whole-call time, TFLOPS and percent of 10 * the measured bf16 HMMA peak (--peak, default 117.26: evidence TGEMM-CUT1-`5b10b824`/peak.log, the gate window; 11 * peak-window1.log of the same day read 120.64; probe gpu_tc_peak_test) 12 * Verdict line last: "GPU_TGEMM: PASS|FAIL". */ 13 #include "omega_blackwell_codegen_tgemm.h" 14 #include "omega_gpu_tgemm_api.h" 15 #include "omega_gpu_prefill.h" 16 #include "bw_hmma_model.h" 17 #include "bw_warp_sim_tc.h" 18 #include 19 #include 20 #include 21 #include 22 #include 23 #include 24 #include 25 26 static const HmmaModel GB10 = { 16, 2, 0, 2, 0 }; 27 static uint64_t rng = 0x243f6a8885a308d3ull; 28 static uint32_t rnd(void) { rng ^= rng << 13; rng ^= rng >> 7; rng ^= rng << 17; return (uint32_t)(rng >> 16); } 29 static float frnd(void) { return ((float)(rnd() & 0xffffff) / `16777216`.0f) * 2.0f - 1.0f; } 30 static float u2f(uint32_t u) { float f; memcpy(&f, &u, 4); return f; } 31 static uint32_t f2u(float f) { uint32_t u; memcpy(&u, &f, 4); return u; } 32 static uint16_t bf16_rn(float f) { uint32_t u = f2u(f); if ((u & 0x7fffffffu) > 0x7f800000u) return 0x7fc0u; return (uint16_t)((u + 0x7fffu + ((u >> 16) & 1u)) >> 16); } 33 static float bf(uint16_t h) { return u2f((uint32_t)h << 16); } 34 static double now_ns(void) { struct timespec t; clock_gettime(CLOCK_MONOTONIC, &t); return (double)t.tv_sec * 1e9 + (double)t.tv_nsec; } 35 36 typedef struct { uint32_t M, N, K; uint16_t *a, *b; } Prob; 37 static void prob_make(Prob *p, uint32_t M, uint32_t N, uint32_t K) { 38 p->M = M; p->N = N; p->K = K; 39 p->a = malloc((size_t)M * K * 2); p->b = malloc((size_t)K * N * 2); 40 for (size_t i = 0; i < (size_t)M * K; i++) p->a[i] = bf16_rn(frnd() * (rnd() % 16 == 0 ? 8.0f : 1.0f)); 41 for (size_t i = 0; i < (size_t)K * N; i++) p->b[i] = bf16_rn(frnd() * (rnd() % 16 == 0 ? 8.0f : 1.0f)); 42 } 43 static void prob_free(Prob *p) { free(p->a); free(p->b); } 44 45 /* the kernel's arithmetic for output (i, c) over blocks kb0 .. kb0 + nkb - 1: one fused 16-term HMMA per (32-k group, step) */ 46 static float emu(const Prob *p, uint32_t i, uint32_t c, uint32_t kb0, uint32_t nkb) { 47 float acc = 0.0f; 48 for (uint32_t G = kb0 * 4u; G < (kb0 + nkb) * 4u; G++) for (uint32_t s = 0; s < 2; s++) { 49 float a[16], b[16]; int m = 0; 50 for (uint32_t t = 0; t < 4; t++) for (uint32_t j = 0; j < 4; j++) { 51 const uint32_t k = G * 32u + 8u * t + 4u * s + j; 52 a[m] = bf(p->a[(size_t)i * p->K + k]); b[m] = bf(p->b[(size_t)k * p->N + c]); m++; 53 } 54 acc = hm_dot16(&GB10, a, b, acc); 55 } 56 return acc; 57 } 58 59 static int host_only(void) { 60 int fail = 0; 61 static const struct { OmegaTgemmSpec s; int production; } specs[] = { 62 { { 2304, 768, 8, 2, 16, 32, 1, 0, 0, 0 }, 1 }, { { 768, 3072, 8, 2, 16, 32, 1, 0, 0, 0 }, 1 }, { { 768, 50304, 4, 2, 8, 32, 1, 0, 0, 0 }, 1 } /* lm_head forward: n % 256 != 0 picks rt 4 x 8 warps */, { { 50304, 768, 4, 2, 8, 32, 1, 0, 0, 0 }, 0 }, 63 { { 768, 2304, 4, 2, 16, 32, 2, 0, 0, 0 }, 0 }, { { 768, 768, 4, 2, 16, 32, 1, 0, 0, 0 }, 0 }, { { 768, 768, 4, 2, 8, 32, 1, 0, 0, 0 }, 0 }, { { 768, 768, 2, 2, 8, 32, 1, 0, 0, 0 }, 0 }, 64 { { 768, 768, 8, 2, 8, 32, 1, 0, 0, 0 }, 0 }, 65 }; 66 static BlackwellIRProgram prog; 67 for (size_t i = 0; i < sizeof specs / sizeof specs[0]; i++) { 68 const OmegaTgemmSpec *s = &specs[i].s; 69 int rc = omega_blackwell_codegen_tgemm_prog(s, &prog); 70 uint32_t peak = rc == 0 ? prog.regalloc.peak_gpr_usage : 0, decl = omega_bw_gpr_declared(peak); 71 int ok = rc == 0 && prog.count <= OMEGA_TGEMM_MAX_INSNS && decl <= 128u && 32u * s->warps * decl <= 65536u; 72 printf("spec k %u n %u rt %u ct %u warps %u kc %u aqn %u: %s, %zu instructions, peak %u, declared %u, shared %u B -> %s%s\n", s->k, s->n, s->rt, s->ct, s->warps, s->kc, s->aqn, 73 rc ? "REFUSED" : "built", rc ? (size_t)0 : prog.count, peak, decl, omega_tgemm_shared_bytes(s), ok ? "fits" : "DOES NOT FIT", specs[i].production ? " (production)" : ""); 74 if (!ok && specs[i].production) fail++; 75 } 76 return fail; 77 } 78 79 typedef struct { uint32_t M, N, K, rt, warps, aqn, kb0, nkb; } SimCase; 80 static int sim_run(const Prob *p, const SimCase *c, int mutant, int order, float *y, char *msg, size_t msgn) { 81 static BlackwellIRProgram prog; 82 OmegaTgemmSpec sp = { p->K, p->N, c->rt, 2, c->warps, 32, c->aqn, OMEGA_TGEMM_LAYOUT_NN, OMEGA_TGEMM_EPI_F32, mutant }; 83 if (omega_blackwell_codegen_tgemm_prog(&sp, &prog) != 0) { snprintf(msg, msgn, "codegen refused (spec_ok %d)", omega_tgemm_spec_ok(&sp)); return -1; } 84 const uint32_t bm = omega_tgemm_bm(&sp), span = omega_tgemm_span(&sp), nt = p->M / bm; 85 OmegaTgemmTile *tiles = calloc(nt, sizeof *tiles); 86 for (uint32_t t = 0; t < nt; t++) { tiles[t].c_va = (uintptr_t)y; tiles[t].row0 = t * bm; tiles[t].kb0 = c->kb0; tiles[t].nkb = c->nkb; } 87 memset(y, 0xee, (size_t)p->M * p->N * 4); 88 uint8_t *smem = malloc(omega_tgemm_shared_bytes(&sp)); 89 static WsSim s; memset(&s, 0, sizeof s); 90 s.p = &prog; s.threads = 32u * sp.warps; s.smem = smem; s.smem_bytes = omega_tgemm_shared_bytes(&sp); s.order = order; 91 const uint64_t a[3] = { (uintptr_t)tiles, (uintptr_t)p->a, (uintptr_t)p->b }; 92 for (int i = 0; i < 3; i++) { s.cbank[(0x380 + 8 * i) / 4] = (uint32_t)a[i]; s.cbank[(0x380 + 8 * i) / 4 + 1] = (uint32_t)(a[i] >> 32); } 93 s.ranges[0].lo = (uintptr_t)tiles; s.ranges[0].hi = (uintptr_t)(tiles + nt); 94 s.ranges[1].lo = (uintptr_t)p->a; s.ranges[1].hi = (uintptr_t)(p->a + (size_t)p->M * p->K); 95 s.ranges[2].lo = (uintptr_t)p->b; s.ranges[2].hi = (uintptr_t)(p->b + (size_t)p->K * p->N); 96 s.ranges[3].lo = (uintptr_t)y; s.ranges[3].hi = (uintptr_t)(y + (size_t)p->M * p->N); 97 s.nranges = 4; 98 int err = ws_run(&s, p->N / span, nt); 99 if (err) snprintf(msg, msgn, "simulator %s", s.msg); 100 free(tiles); free(smem); 101 return err ? -1 : 0; 102 } 103 static size_t sim_compare(const Prob *p, const float *y, uint32_t kb0, uint32_t nkb) { 104 size_t bad = 0; 105 for (uint32_t i = 0; i < p->M; i++) for (uint32_t c = 0; c < p->N; c++) { 106 const float want = emu(p, i, c, kb0, nkb); 107 if (f2u(y[(size_t)i * p->N + c]) != f2u(want)) { if (getenv("TGDBG") && bad < 8) printf(" row %u col %u got %.9g want %.9g\n", i, c, y[(size_t)i * p->N + c], want); bad++; } 108 } 109 return bad; 110 } 111 static int sim_tests(void) { 112 int fail = 0; char msg[256]; 113 static const SimCase cs[] = { 114 { 128, 512, 256, 4, 16, 1, 0, 2 }, { 64, 256, 384, 2, 8, 1, 1, 2 }, { 128, 256, 128, 4, 16, 2, 0, 1 }, { 128, 256, 256, 4, 8, 2, 0, 2 }, { 256, 512, 128, 8, 16, 1, 0, 1 }, 115 }; 116 for (size_t c = 0; c < sizeof cs / sizeof cs[0]; c++) { 117 Prob p; prob_make(&p, cs[c].M, cs[c].N, cs[c].K); 118 float *y = malloc((size_t)p.M * p.N * 4); 119 for (int order = 0; order < 2; order++) { 120 int rc = sim_run(&p, &cs[c], 0, order, y, msg, sizeof msg); 121 size_t bad = rc ? 0 : sim_compare(&p, y, cs[c].kb0, cs[c].nkb); 122 printf("sim case %zu (M %u N %u K %u rt %u warps %u aqn %u blocks %u..%u) order %d: %s, %zu of %zu differ\n", c, p.M, p.N, p.K, cs[c].rt, cs[c].warps, cs[c].aqn, 123 cs[c].kb0, cs[c].kb0 + cs[c].nkb - 1, order, rc ? msg : "ran", bad, (size_t)p.M * p.N); 124 if (rc || bad) fail++; 125 } 126 if (c == 0) for (int m = 1; m <= 4; m++) { 127 int rc = sim_run(&p, &cs[c], m, 0, y, msg, sizeof msg); 128 size_t bad = rc ? 0 : sim_compare(&p, y, cs[c].kb0, cs[c].nkb); 129 printf("sim case %zu mutant %d: %s\n", c, m, rc ? msg : bad ? "caught" : "NOT CAUGHT"); 130 if (rc || !bad) fail++; 131 } 132 free(y); prob_free(&p); 133 } 134 return fail; 135 } 136 137 /* ---- chip: double reference over the bf16 inputs, threaded over rows ---- */ 138 typedef struct { const Prob *p; const float *y; uint32_t r0, r1; size_t bad, emu_same; double worst; size_t bc4[4], br8[2], brt[4], bw[16], nan, shown; } RefJob; 139 static void *ref_rows(void *arg) { 140 RefJob *j = arg; const Prob *p = j->p; 141 double *col = malloc((size_t)p->N * 16); 142 for (uint32_t i = j->r0; i < j->r1; i++) { 143 memset(col, 0, (size_t)p->N * 16); 144 const uint16_t *ar = p->a + (size_t)i * p->K; 145 for (uint32_t k = 0; k < p->K; k++) { 146 const double av = bf(ar[k]); const uint16_t *br = p->b + (size_t)k * p->N; 147 for (uint32_t c = 0; c < p->N; c++) { const double t = av * (double)bf(br[c]); col[2 * c] += t; col[2 * c + 1] += fabs(t); } 148 } 149 for (uint32_t c = 0; c < p->N; c++) { 150 const float got = j->y[(size_t)i * p->N + c]; 151 const double scale = col[2 * c + 1] > 1e-6 ? col[2 * c + 1] : 1e-6, rel = fabs((double)got - col[2 * c]) / scale; 152 if (!(rel < 1e-5)) { j->bad++; j->bc4[c % 4]++; j->br8[(i >> 3) & 1]++; j->brt[(i >> 4) & 3]++; j->bw[(c % 256) / 16]++; j->nan += isnan(got) || isinf(got); 153 if (getenv("TGDBG") && j->shown < 6) { j->shown++; printf(" bad row %u col %u got %.9g ref %.9g emu %.9g\n", i, c, got, col[2 * c], emu(p, i, c, 0, p->K / 128u)); } } 154 if (rel > j->worst) j->worst = rel; 155 if (f2u(got) == f2u(emu(p, i, c, 0, p->K / 128u))) j->emu_same++; 156 } 157 } 158 free(col); 159 return NULL; 160 } 161 static size_t ref_check(const Prob *p, const float *y, size_t *emu_same, double *worst) { 162 long nproc = sysconf(_SC_NPROCESSORS_ONLN); int nt = nproc < 1 ? 1 : nproc > 32 ? 32 : (int)nproc; 163 pthread_t th[32]; RefJob jobs[32]; memset(jobs, 0, sizeof jobs); 164 for (int t = 0; t < nt; t++) { jobs[t].p = p; jobs[t].y = y; jobs[t].r0 = (uint32_t)((uint64_t)p->M * t / nt); jobs[t].r1 = (uint32_t)((uint64_t)p->M * (t + 1) / nt); pthread_create(&th[t], NULL, ref_rows, &jobs[t]); } 165 size_t bad = 0; *emu_same = 0; *worst = 0; 166 for (int t = 0; t < nt; t++) { pthread_join(th[t], NULL); bad += jobs[t].bad; *emu_same += jobs[t].emu_same; if (jobs[t].worst > *worst) *worst = jobs[t].worst; } 167 if (getenv("TGDBG") && bad) { size_t c4[4] = { 0 }, r8[2] = { 0 }, rt[4] = { 0 }, w[16] = { 0 }, nn = 0; 168 for (int t = 0; t < nt; t++) { for (int q = 0; q < 4; q++) { c4[q] += jobs[t].bc4[q]; rt[q] += jobs[t].brt[q]; } for (int q = 0; q < 2; q++) r8[q] += jobs[t].br8[q]; for (int q = 0; q < 16; q++) w[q] += jobs[t].bw[q]; nn += jobs[t].nan; } 169 printf(" bad by col%%4: %zu %zu %zu %zu; by row half: %zu %zu; by row tile: %zu %zu %zu %zu; nan/inf %zu\n bad by warp:", c4[0], c4[1], c4[2], c4[3], r8[0], r8[1], rt[0], rt[1], rt[2], rt[3], nn); 170 for (int q = 0; q < 16; q++) printf(" %zu", w[q]); 171 printf("\n"); } 172 return bad; 173 } 174 static int cmp_d(const void *a, const void *b) { double x = *(const double *)a, y = *(const double *)b; return x < y ? -1 : x > y; } 175 176 static int chip_shape(uint32_t M, uint32_t N, uint32_t K, int cached, int reps, double peak, double gate_pct) { 177 Prob p; prob_make(&p, M, N, K); 178 const size_t ab = (size_t)M * K * 2, bb = (size_t)K * N * 2, cb = (size_t)M * N * 4; 179 OmegaGpuMem ad = { 0 }, bd = { 0 }, cd = { 0 }; 180 int rc = cached ? omega_gpu_pf_alloc_dev(ab, &ad) : omega_gpu_pf_alloc_host(ab, &ad); 181 if (!rc) rc = cached ? omega_gpu_pf_alloc_dev(bb, &bd) : omega_gpu_pf_alloc_host(bb, &bd); 182 if (!rc) rc = cached ? omega_gpu_pf_alloc_dev(cb, &cd) : omega_gpu_pf_alloc_host(cb, &cd); 183 if (!rc) rc = omega_gpu_pf_upload(&ad, 0, p.a, ab); 184 if (!rc) rc = omega_gpu_pf_upload(&bd, 0, p.b, bb); 185 uint8_t *poison = malloc(cb); memset(poison, 0xff, cb); 186 float *y1 = malloc(cb), *y2 = malloc(cb); 187 if (!rc) rc = omega_gpu_pf_upload(&cd, 0, poison, cb); 188 if (rc) { 189 printf("shape %ux%ux%u setup: %s (%s)\n", M, N, K, omega_gpu_pf_rc_name(rc), omega_gpu_session_last_error()); 190 free(poison); free(y1); free(y2); omega_gpu_pf_free(&ad); omega_gpu_pf_free(&bd); omega_gpu_pf_free(&cd); prob_free(&p); 191 return 1; 192 } 193 OmegaTgemmCall call = { OMEGA_TGEMM_LAYOUT_NN, OMEGA_TGEMM_EPI_F32, M, N, K, ad.va, bd.va, cd.va }; 194 OmegaTgemmSpec sp; 195 if (omega_gpu_tgemm_spec(&call, &sp) != 0) { 196 printf("shape %ux%ux%u: spec refused\n", M, N, K); 197 free(poison); free(y1); free(y2); omega_gpu_pf_free(&ad); omega_gpu_pf_free(&bd); omega_gpu_pf_free(&cd); prob_free(&p); 198 return 1; 199 } 200 const char *kind = cached ? "cached" : "uncached"; 201 int fail = 0; 202 if (reps > 64) reps = 64; 203 double chip[64], wall[64]; 204 for (int r = 0; r < reps && !rc; r++) { uint64_t ns = 0; const double t0 = now_ns(); rc = omega_gpu_tgemm(&call, &ns); wall[r] = now_ns() - t0; chip[r] = (double)ns; } 205 if (!rc) rc = omega_gpu_pf_download(&cd, 0, y1, cb); 206 if (!rc) rc = omega_gpu_pf_upload(&cd, 0, poison, cb); 207 if (!rc) rc = omega_gpu_tgemm(&call, NULL); 208 if (!rc) rc = omega_gpu_pf_download(&cd, 0, y2, cb); 209 if (rc) { printf("shape %ux%ux%u %s run: %s (%s)\n", M, N, K, kind, omega_gpu_pf_rc_name(rc), omega_gpu_session_last_error()); fail++; } 210 else { 211 size_t left = 0; for (size_t i = 0; i < (size_t)M * N; i++) left += f2u(y1[i]) == 0xffffffffu; 212 const int same = !memcmp(y1, y2, cb); 213 size_t emu_same = 0; double worst = 0; 214 const double t0 = now_ns(); 215 const size_t bad = ref_check(&p, y1, &emu_same, &worst); 216 qsort(chip, reps, 8, cmp_d); qsort(wall, reps, 8, cmp_d); 217 const double fl = 2.0 * M * N * K, mc = chip[reps / 2], mw = wall[reps / 2], tc = fl / mc / 1e3, tw = fl / mw / 1e3; 218 printf("TGEMM %ux%ux%u %s rt %u warps %u tiles %u grid_x %u: reference %zu of %zu outside 1e-5 (worst %.3g), %zu bit-identical to the emulation, repeats identical %s, poison left %zu (reference %.1f s)\n", 219 M, N, K, kind, sp.rt, sp.warps, M / omega_tgemm_bm(&sp), N / omega_tgemm_span(&sp), bad, (size_t)M * N, worst, emu_same, same ? "yes" : "NO", left, (now_ns() - t0) / 1e9); 220 printf("TGEMM %ux%ux%u %s: chip median %.3f ms (min %.3f) = %.2f TFLOPS = %.1f%% of peak %.2f; whole call median %.3f ms = %.2f TFLOPS = %.1f%%%s\n", 221 M, N, K, kind, mc / 1e6, chip[0] / 1e6, tc, 100.0 * tc / peak, peak, mw / 1e6, tw, 100.0 * tw / peak, cached && gate_pct > 0 ? (100.0 * tc / peak >= gate_pct ? " GATE ok" : " GATE FAIL") : ""); 222 if (bad || !same || left) fail++; 223 if (cached && gate_pct > 0 && !(100.0 * tc / peak >= gate_pct)) fail++; /* the gate is on device-resident (GPU-cached) buffers; the uncached pass is the correctness-first step (R-8) */ 224 if (!cached) { /* negative control: the parity-swapped kernel must give a different result (a comparison that cannot fail is no comparison) */ 225 for (int m = 4; m >= 1; m -= 3) { 226 omega_gpu_tgemm_test_set_mutant(m); 227 int mrc = omega_gpu_tgemm(&call, NULL); 228 omega_gpu_tgemm_test_set_mutant(0); 229 if (!mrc) mrc = omega_gpu_pf_download(&cd, 0, y2, cb); 230 const int diff = !mrc && memcmp(y1, y2, cb) != 0; 231 printf("TGEMM %ux%ux%u mutant %d: %s\n", M, N, K, m, mrc ? "launch failed" : diff ? "caught" : "NOT CAUGHT"); 232 if (!diff) fail++; 233 } 234 } 235 } 236 free(poison); free(y1); free(y2); 237 omega_gpu_pf_free(&ad); omega_gpu_pf_free(&bd); omega_gpu_pf_free(&cd); 238 prob_free(&p); 239 return fail; 240 } 241 242 int main(int argc, char **argv) { 243 int host = 1, sim = 1, chip = 0, reps = 7, cached_only = 0, uncached_only = 0; double peak = 117.26, gate = 0; const char *shape = NULL; 244 for (int i = 1; i < argc; i++) { 245 if (!strcmp(argv[i], "--host-only")) sim = 0; 246 else if (!strcmp(argv[i], "--sim")) host = 0; 247 else if (!strcmp(argv[i], "--chip")) { chip = 1; host = 0; sim = 0; } 248 else if (!strcmp(argv[i], "--shape") && i + 1 < argc) shape = argv[++i]; 249 else if (!strcmp(argv[i], "--reps") && i + 1 < argc) reps = atoi(argv[++i]); 250 else if (!strcmp(argv[i], "--peak") && i + 1 < argc) peak = atof(argv[++i]); 251 else if (!strcmp(argv[i], "--gate") && i + 1 < argc) gate = atof(argv[++i]); 252 else if (!strcmp(argv[i], "--cached-only")) cached_only = 1; 253 else if (!strcmp(argv[i], "--mutant") && i + 1 < argc) omega_gpu_tgemm_test_set_mutant(atoi(argv[++i])); /* timing probes: results are wrong on purpose */ 254 else if (!strcmp(argv[i], "--uncached-only")) uncached_only = 1; 255 else if (!strcmp(argv[i], "--shape-knob") && i + 3 < argc) { omega_gpu_tgemm_set_shape((uint32_t)atoi(argv[i + 1]), (uint32_t)atoi(argv[i + 2]), (uint32_t)atoi(argv[i + 3])); i += 3; } 256 } 257 int fail = 0; 258 if (host) fail += host_only(); 259 if (sim) fail += sim_tests(); 260 if (chip) { 261 static const char *gate_shapes[] = { "8192x768x2304", "8192x768x768", "8192x768x3072", "8192x3072x768" }; 262 for (size_t s = 0; s < (shape ? 1u : sizeof gate_shapes / sizeof gate_shapes[0]); s++) { 263 unsigned M = 0, N = 0, K = 0; 264 if (sscanf(shape ? shape : gate_shapes[s], "%ux%ux%u", &M, &N, &K) != 3) { printf("bad shape\n"); fail++; break; } 265 if (!cached_only) fail += chip_shape(M, N, K, 0, reps, peak, gate); 266 if (!uncached_only) fail += chip_shape(M, N, K, 1, reps, peak, gate); 267 } 268 } 269 printf("GPU_TGEMM: %s\n", fail ? "FAIL" : "PASS"); 270 return fail ? 1 : 0; 271 }