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/evidence/FB1-CUT4B-88f3f59-probe/gpu_session_probe.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 / evidence / FB1-CUT4B-88f3f59-probe / gpu_session_probe.c` 56 lines ยท 2996 bytes Raw Blame History 1 /* gpu_session_probe: FB-1 cut 4b flake investigation (first-call device-open failure). 2 * 3 * One fresh process = one sample: open the shared device through the API's own 4 * path (omega_gpu_ex2_f32 on 128 values is the smallest launch there is), report 5 * the stage that failed (with the driver's own text) or the open time, exit 0/1. 6 * 7 * ./gpu_session_probe [--label L] [--calls N] [--hold-ms M] 8 * --calls N launches after the first (default 1); keeps the device busy for an overlap test 9 * --hold-ms M sleep M ms with the device open before exit (overlap window for a second probe) 10 * 11 * Output (one line, Astra's SNAP shape; every unknown says so): 12 * PROBE label=L pid=P rc=OK|CHIP_FAIL|... stage="..." first_call_ms=F open_ms=O calls_ok=K/N opens=1 13 * Never run outside the heavy queue (tools/probe_gpu_open.sh). 14 */ 15 #include "omega_gpu_elementwise_api.h" 16 #include "omega_gpu_session.h" 17 #include 18 #include 19 #include 20 #include 21 #include 22 23 static double now_ms(void) { struct timespec t; clock_gettime(CLOCK_MONOTONIC, &t); return t.tv_sec * 1e3 + t.tv_nsec / 1e6; } 24 25 int main(int argc, char **argv) { 26 const char *label = "probe"; int calls = 1, hold_ms = 0; 27 for (int i = 1; i < argc; i++) { 28 if (strcmp(argv[i], "--label") == 0 && i + 1 < argc) label = argv[++i]; 29 else if (strcmp(argv[i], "--calls") == 0 && i + 1 < argc) calls = atoi(argv[++i]); 30 else if (strcmp(argv[i], "--hold-ms") == 0 && i + 1 < argc) hold_ms = atoi(argv[++i]); 31 else { fprintf(stderr, "unknown flag %s\n", argv[i]); return 2; } 32 } 33 float x[128], y[128]; 34 for (int i = 0; i < 128; i++) { x[i] = (float)i / 16.0f - 4.0f; y[i] = 0.0f; } 35 OmegaGpuEwInfo info; memset(&info, 0, sizeof info); 36 double t0 = now_ms(); 37 int rc = omega_gpu_ex2_f32(128, x, y, &info); 38 double first_ms = now_ms() - t0; 39 int ok = 0; 40 if (rc == OMEGA_GPU_EW_OK) { 41 /* negative control on the result itself: 2^0 must be 1 (x[64] = 0) */ 42 if (y[64] < 0.999f || y[64] > 1.001f) { rc = OMEGA_GPU_EW_UNWRITTEN; omega_gpu_session_set_error("probe: 2^0 != 1"); } 43 else ok = 1; 44 } 45 int more_ok = 0; 46 for (int i = 1; i < calls && ok; i++) if (omega_gpu_ex2_f32(128, x, y, &info) == OMEGA_GPU_EW_OK) more_ok++; 47 if (hold_ms > 0) usleep((useconds_t)hold_ms * 1000u); 48 const char *stage = omega_gpu_elementwise_last_error(); 49 printf("PROBE label=%s pid=%d rc=%s stage=\"%s\" first_call_ms=%.1f chip_us=%.1f calls_ok=%d/%d opens=%u%s\n", 50 label, (int)getpid(), omega_gpu_elementwise_rc_name(rc), stage[0] ? stage : "-", first_ms, 51 info.elapsed_ns / 1e3, ok + more_ok, calls, omega_gpu_session_open_count(), 52 rc == OMEGA_GPU_EW_OK && !stage[0] ? "" : (rc == OMEGA_GPU_EW_OK ? " note=stage_text_from_earlier_failure" : "")); 53 fflush(stdout); 54 omega_gpu_session_close(); /* the explicit close is part of what the next process sees */ 55 return ok ? 0 : 1; 56 }