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
CUDApp / evidence / FLASH-NEXT-MOE-SHAPES-20261118 / identity_probe.c
| 1 | /* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception */ |
| 2 | /* Prints one line per FP8 GEMV spec of a fixed grid: return code, IR instruction count and an FNV-1a 64 hash of the ENCODED SASS bytes, for variant 1 and |
| 3 | * variant 2. Built once against the base library (997e1050) and once against the branch head; the two outputs must be identical (requirement 1: |
| 4 | * every shape accepted today keeps byte-identical generated code). Host only, no device. */ |
| 5 | #include <stdio.h> |
| 6 | #include <stdlib.h> |
| 7 | #include <string.h> |
| 8 | #include "omega_blackwell_codegen_moe.h" |
| 9 | #include "omega_blackwell_codegen_moe2.h" |
| 10 | static uint64_t fnv(const uint8_t *p, size_t n) { uint64_t h = 1469598103934665603ull; for (size_t i = 0; i < n; i++) { h ^= p[i]; h *= 1099511628211ull; } return h; } |
| 11 | int main(void) { |
| 12 | static const uint32_t ks[] = { 128, 256, 384, 512, 640, 768, 1024, 1536, 2048, 2560, 4096, 5120, 17408 }; |
| 13 | static const uint32_t lbs[] = { 8, 16 }, rows[] = { 1, 2, 4, 8 }, warps[] = { 1, 3, 8, 32 }, depths[] = { 0, 1, 2, 4, 5, 8 }; |
| 14 | BlackwellIRProgram *p = calloc(1, sizeof *p); |
| 15 | static uint8_t buf[BW_MAX_IR_INSNS * 16]; |
| 16 | unsigned lines = 0, accepted = 0; |
| 17 | for (int v = 1; v <= 2; v++) |
| 18 | for (unsigned a = 0; a < sizeof ks / 4; a++) for (unsigned b = 0; b < 2; b++) for (unsigned c = 0; c < 4; c++) for (unsigned d = 0; d < 4; d++) |
| 19 | for (unsigned e = 0; e < 6; e++) for (unsigned sched = 0; sched < 2; sched++) for (unsigned coal = 0; coal < 2; coal++) for (unsigned wf = 0; wf < 2; wf++) |
| 20 | for (int m = 0; m < 6; m++) { |
| 21 | OmegaFp8GemvSpec s = { ks[a], lbs[b], rows[c], warps[d], depths[e], m, sched, coal, wf }; |
| 22 | if (v == 2 && (sched || coal || wf || m > 3)) continue; |
| 23 | const int rc = v == 1 ? omega_blackwell_codegen_fp8_gemv_prog(&s, p) : omega_blackwell_codegen_fp8_gemv2_prog(&s, p); |
| 24 | size_t n = 0; uint64_t h = 0; unsigned cnt = 0; |
| 25 | if (rc == 0) { cnt = (unsigned)p->count; if (omega_bw_encode_program(p, buf, sizeof buf, &n) == 0) h = fnv(buf, n); accepted++; } |
| 26 | printf("v%d k=%u lb=%u r=%u w=%u d=%u m=%d s=%u c=%u f=%u rc=%d n=%u sass=%zu h=%016llx steps=%u shared=%u\n", v, s.k, s.lane_bytes, s.rows, s.warps, s.depth, m, sched, coal, wf, rc, cnt, n, (unsigned long long)h, |
| 27 | v == 1 ? omega_fp8_gemv_steps(&s) : 0u, v == 1 ? omega_fp8_gemv_shared_bytes(&s) : omega_fp8_gemv2_shared_bytes(&s)); |
| 28 | lines++; |
| 29 | } |
| 30 | fprintf(stderr, "lines=%u accepted=%u\n", lines, accepted); |
| 31 | return 0; |
| 32 | } |