interplane.Get Omega
Read in your language

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

branch main Branches Tags History

CUDApp / evidence / tern-rowmajor-20261106 / independent-rows.c

25 lines · 1354 bytes Raw Blame History
1/* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception */
2/* Verification-only: original fixture data, independent unpacked dot product.
3 * Expand ~ to HOME before compiling, as with the receipt logs.
4 * The SPDX and path-expansion comments are archival, not behavioral changes. */
5#define main omega_tern_original_main
6#include "~/work/cudastack/omega-mv/tests/gpu_tern_test.c"
7#undef main
8int main(void) {
9 OmegaTernGemvSpec sp = {512, 0, 2, 2, 2, 0, 0};
10 int8_t *w = make_w(13u * 512u, 0.3, 101), *x = make_x(512, 108);
11 static const int32_t expected[13] = {-3013,2779,-1089,-2155,-1793,-2083,-240,604,-1545,1900,-156,1931,-1037};
12 uint32_t y[13]; char msg[240]; int bad = 0;
13 int32_t *ref = oracle(w, 13, 512, x);
14 int rc = sim_run(&sp, 13, w, x, NULL, NULL, 1.0f, 2, 0, y, msg, sizeof msg);
15 printf("original smallest case: sim rc %d\n", rc);
16 for (unsigned r = 0; r < 13; r++) {
17 int32_t dot = 0;
18 for (unsigned c = 0; c < 512; c++) dot += (int32_t)w[r*512+c] * (int32_t)x[c];
19 printf("row %u: Wolfram %d independent-dot %d algebra %d sim %d\n",r,expected[r],dot,ref[r],(int32_t)y[r]);
20 if (expected[r] != dot || ref[r] != dot || (int32_t)y[r] != dot) bad++;
21 }
22 free(w); free(x); free(ref);
23 printf("independent original rows: %d mismatches\n",bad);
24 return rc || bad ? 1 : 0;
25}