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/evidence/freest-leftovers-20261106/coverage.log # 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 / evidence / freest-leftovers-20261106 / coverage.log` 588 lines · 28946 bytes Raw Blame History 1 $ bwrap --dev-bind / / --dev /dev --proc /proc -- taskset -c 10-14 nice -n 10 make test-leftovers-coverage 2 rm -f build/leftovers/coverage/*.gcda 3 cc -std=gnu11 -Wall -Wextra -Werror -MMD -MP -D_GNU_SOURCE -O2 -Isrc -I./m16 -I./nvrm -I./third_party/nvidia-open-580.173.02/src/common/sdk/nvidia/inc -I./third_party/nvidia-open-580.173.02/kernel-open/common/inc -I./third_party/nvidia-open-580.173.02/kernel-open/nvidia-uvm -I./third_party/nvidia-open-580.173.02/src/nvidia/arch/nvalloc/unix/include -I./third_party/aien-gpu-abi1 -DCUDAPP_MIGRATION_PENDING_GEMM_EX=1 -O0 --coverage -DLEFTOVERS_ORACLE -Isrc -o build/leftovers/coverage/diff tests/leftovers_test.c src/cudapp_freest_leftovers.c 4 build/leftovers/coverage/diff 5 LEFTOVERS PASS checks=3230 6 gcov -b -c -t build/leftovers/coverage/diff-leftovers_test.gcno 7 -: 0:Source:tests/leftovers_test.c 8 -: 0:Graph:build/leftovers/coverage/diff-leftovers_test.gcno 9 -: 0:Data:build/leftovers/coverage/diff-leftovers_test.gcda 10 -: 0:Runs:1 11 -: 1:/* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception */ 12 -: 2:#include 13 -: 3:#include 14 -: 4:#include 15 -: 5:#include 16 -: 6:#define CUDAPP_MIGRATION_PENDING_LEFTOVERS 1 17 -: 7:#define omega_path_byte oracle_path_byte 18 -: 8:#define omega_path_copy oracle_path_copy 19 -: 9:#include "omega_path_check.h" 20 -: 10:#undef omega_path_byte 21 -: 11:#undef omega_path_copy 22 -: 12:#undef CUDAPP_MIGRATION_PENDING_LEFTOVERS 23 -: 13:#undef OMEGA_PATH_CHECK_H 24 -: 14:#include "omega_path_check.h" 25 -: 15:#ifdef LEFTOVERS_ORACLE 26 -: 16:#define CUDAPP_MIGRATION_PENDING_LEFTOVERS 1 27 -: 17:#endif 28 -: 18:#include "omega_numeric_lifecycle.h" 29 -: 19:#include "omega_gpu_q36_native.h" 30 -: 20:#ifdef LEFTOVERS_ORACLE 31 -: 21:#undef CUDAPP_MIGRATION_PENDING_LEFTOVERS 32 -: 22:#endif 33 -: 23:atomic_int omega_numeric_native_state; 34 -: 24:static unsigned checks; 35 -: 25:#define CHECK(x) do { ++checks; if (!(x)) { fprintf(stderr,"FAIL line %d\n",__LINE__); return 1; } } while (0) 36 function path called 882 returned 100% blocks executed 67% 37 882: 26:static int path(const char *s, size_t cap) { 38 882: 27: char a[64], b[64]; memset(a, 85, sizeof a); memset(b, 85, sizeof b); 39 882: 28: int ar = oracle_path_copy(a, cap, s), br = omega_path_copy(b, cap, s); 40 call 0 returned 882 41 call 1 returned 882 42 -: 29:#ifdef LEFTOVERS_RED 43 -: 30: br ^= 1; 44 -: 31:#endif 45 882*: 32: CHECK(ar == br); 46 branch 0 taken 0 (fallthrough) 47 branch 1 taken 882 48 call 2 never executed 49 -: 33: /* Refusals promise an empty string, not equality of scratch bytes. */ 50 882*: 34: CHECK(cap == 0 || strcmp(a, b) == 0); 51 branch 0 taken 863 (fallthrough) 52 branch 1 taken 19 53 branch 2 taken 0 (fallthrough) 54 branch 3 taken 863 55 call 4 never executed 56 882: 35: return 0; 57 -: 36:} 58 function main called 1 returned 100% blocks executed 70% 59 1: 37:int main(void) { 60 1: 38: const char *cases[] = {NULL,"","/",".","..","...","a/../b","../","a/..","a/./b","a//b/","/..","/a/b","a b","a\nb","AZaz09._-/+,=@:~","..a","a..","a/.../b"}; 61 20: 39: for (size_t i=0;i>63||!p?UINT64_MAX:0))); 188 branch 0 taken 20 (fallthrough) 189 branch 1 taken 2 190 branch 2 taken 16 (fallthrough) 191 branch 3 taken 4 192 branch 4 taken 8 (fallthrough) 193 branch 5 taken 8 194 branch 6 taken 0 (fallthrough) 195 branch 7 taken 22 196 call 8 never executed 197 -: 71: } 198 132: 72: for (unsigned j=0;jkeys, 128, g->count, actual, 4) != OMEGA_OK) 302 -: 78: return -1; 303 -: 79: memcpy(&result, &bits, sizeof result); 304 -: 80:#if defined(CUDAPP_MIGRATION_PENDING_LEFTOVERS) && CUDAPP_MIGRATION_PENDING_LEFTOVERS 305 -: 81: if (result == 0) return 1; 306 -: 82: if (result < 0 || !g->context) return -1; 307 -: 83:#else 308 -: 84: uint64_t disposition = UINT64_MAX; 309 -: 85: (void)omega_leftovers(&disposition, 5, bits, g->context != NULL, 0, 0); 310 -: 86: if (disposition != 0) return (int)(int64_t)disposition; 311 -: 87:#endif 312 -: 88: /* The generated unique-match resolver bounds result to 1..count<=32. */ 313 -: 89: *context = &g->context[(uint64_t)result - 1]; 314 -: 90: return 0; 315 -: 91:} 316 -: 92:static inline int omega_q36_native_begin_selected(OmegaGpuQ36NativeState *s, OmegaGpuNativeCache *cache, 317 -: 93: const OmegaGpuNativeArtifact **artifact, OmegaGpuNativeLease *lease, const uint64_t **row) { 318 -: 94: uint64_t out[32] = {0}, result = 0; 319 -: 95: if (row) *row = NULL; 320 -: 96: if (!s) return 1; 321 -: 97: if (omega_native_graph(&result, s->query, 64, s->rows, 1024, cache->pool, 528, 322 -: 98: s->wanted, 4096, s->records, 65536, out, 32) != OMEGA_OK || result != 0) return -1; 323 -: 99: /* The generated resolver already bounds the immutable ordinal to <16. */ 324 -: 100: *artifact = &s->artifact[out[1]]; 325 -: 101: *lease = (OmegaGpuNativeLease){cache, out[17], out[18], out[19]}; 326 -: 102: /* The returned lease pins the selected exact resident realization. Recording 327 -: 103: * takes its own reference; the temporary selection pin is always released. */ 328 -: 104: if (omega_native_bound(*artifact, lease) != 0) { 329 -: 105: (void)omega_native_lease_op(lease, 9, 0); 330 -: 106: *lease = (OmegaGpuNativeLease){0}; 331 -: 107: return -1; 332 -: 108: } 333 -: 109: if (row) *row = s->rows + out[1] * 64; 334 -: 110: return 0; 335 -: 111:} 336 -: 112:static inline int omega_q36_native_begin(OmegaGpuQ36NativeState *s, OmegaGpuNativeCache *cache, 337 -: 113: const OmegaGpuNativeArtifact **artifact, OmegaGpuNativeLease *lease) { 338 -: 114: return omega_q36_native_begin_selected(s, cache, artifact, lease, NULL); 339 -: 115:} 340 -: 116:static inline void omega_q36_native_end(const OmegaGpuNativeLease *lease) { 341 -: 117: (void)omega_native_lease_op(lease, 9, 0); 342 -: 118:} 343 -: 119:static inline void omega_q36_native_release(OmegaGpuQ36NativeState *s) { 344 -: 120: if (!s) return; 345 -: 121: for (unsigned i = 0; i < 16; ++i) 346 -: 122: if (s->prepared[i].cache) (void)omega_native_lease_op(&s->prepared[i], 5, 0); 347 -: 123:} 348 -: 124:static inline void omega_q36_native_graph_release(OmegaGpuQ36NativeGraph *g) { 349 -: 125: if (!g || !g->context) return; 350 -: 126:#if defined(CUDAPP_MIGRATION_PENDING_LEFTOVERS) && CUDAPP_MIGRATION_PENDING_LEFTOVERS 351 -: 127: for (uint64_t i = 0; i < g->count && i < 32; ++i) 352 -: 128:#else 353 -: 129: /* Iteration invokes host lease effects; Omega decides the bounded extent. */ 354 -: 130: for (uint64_t i = 0, more = 0; 355 -: 131: omega_leftovers(&more, 6, g->count, i, 0, 0) == OMEGA_OK && more; ++i) 356 -: 132:#endif 357 -: 133: omega_q36_native_release(&g->context[i]); 358 -: 134:} 359 -: 135:#endif 360 -: 0:Source:src/omega_numeric_lifecycle.h 361 -: 0:Graph:build/leftovers/coverage/diff-leftovers_test.gcno 362 -: 0:Data:build/leftovers/coverage/diff-leftovers_test.gcda 363 -: 0:Runs:1 364 -: 1:/* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 365 -: 2: * Copyright 2026 Drake Stapleton (AIEN / aien-dev) 366 -: 3: * 367 -: 4: * Licensed under the Apache License, Version 2.0 (the "License"); 368 -: 5: * you may not use this file except in compliance with the License. 369 -: 6: * You may obtain a copy of the License at 370 -: 7: * 371 -: 8: * http://www.apache.org/licenses/LICENSE-2.0 372 -: 9: * 373 -: 10: * Unless required by applicable law or agreed to in writing, software 374 -: 11: * distributed under the License is distributed on an "AS IS" BASIS, 375 -: 12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 376 -: 13: * See the License for the specific language governing permissions and 377 -: 14: * limitations under the License. 378 -: 15: */ 379 -: 16: 380 -: 17:#ifndef OMEGA_NUMERIC_LIFECYCLE_H 381 -: 18:#define OMEGA_NUMERIC_LIFECYCLE_H 382 -: 19: 383 -: 20:#include 384 -: 21:#include "cudapp_native.h" 385 -: 22: 386 -: 23:/* One owner across the SIMT, reduction and DIV/SQRT launchers. Defined in 387 -: 24: * omega_numeric.c, which all three already link. No reset API: an uncertain 388 -: 25: * completion requires ending the process and investigating the device. This 389 -: 26: * does not assert that process exit itself resets or recovers the GPU. */ 390 -: 27:enum { OMEGA_NUMERIC_NATIVE_IDLE, OMEGA_NUMERIC_NATIVE_BUSY, 391 -: 28: OMEGA_NUMERIC_NATIVE_UNCERTAIN }; 392 -: 29:extern atomic_int omega_numeric_native_state; 393 -: 30: 394 function omega_numeric_native_acquire called 4 returned 100% blocks executed 100% 395 4: 31:static inline int omega_numeric_native_acquire(void) { 396 4: 32: int expected = OMEGA_NUMERIC_NATIVE_IDLE; 397 -: 33:#if defined(CUDAPP_MIGRATION_PENDING_LEFTOVERS) && CUDAPP_MIGRATION_PENDING_LEFTOVERS 398 4: 34: return atomic_compare_exchange_strong(&omega_numeric_native_state, &expected, 399 4: 35: OMEGA_NUMERIC_NATIVE_BUSY) ? 0 : -1; 400 branch 0 taken 1 (fallthrough) 401 branch 1 taken 3 402 -: 36:#else 403 -: 37: uint64_t result = UINT64_MAX; 404 -: 38: unsigned okay = atomic_compare_exchange_strong(&omega_numeric_native_state, 405 -: 39: &expected, OMEGA_NUMERIC_NATIVE_BUSY); 406 -: 40: (void)omega_leftovers(&result, 3, okay, 0, 0, 0); 407 -: 41: return (int)(int64_t)result; 408 -: 42:#endif 409 -: 43:} 410 function omega_numeric_native_uncertain called 8 returned 100% blocks executed 100% 411 8: 44:static inline int omega_numeric_native_uncertain(void) { 412 -: 45:#if defined(CUDAPP_MIGRATION_PENDING_LEFTOVERS) && CUDAPP_MIGRATION_PENDING_LEFTOVERS 413 8: 46: return atomic_load(&omega_numeric_native_state) == OMEGA_NUMERIC_NATIVE_UNCERTAIN; 414 -: 47:#else 415 -: 48: uint64_t result = 1; 416 -: 49: (void)omega_leftovers(&result, 4, 417 -: 50: (uint64_t)(int64_t)atomic_load(&omega_numeric_native_state), 0, 0, 0); 418 -: 51: return (int)result; 419 -: 52:#endif 420 -: 53:} 421 function omega_numeric_native_poison called 4 returned 100% blocks executed 100% 422 4: 54:static inline void omega_numeric_native_poison(void) { 423 4: 55: atomic_store(&omega_numeric_native_state, OMEGA_NUMERIC_NATIVE_UNCERTAIN); 424 4: 56:} 425 function omega_numeric_native_release called 8 returned 100% blocks executed 100% 426 8: 57:static inline void omega_numeric_native_release(void) { 427 8: 58: int expected = OMEGA_NUMERIC_NATIVE_BUSY; 428 -: 59: /* Never clear a poison latch, even if a cleanup caller arrives late. */ 429 8: 60: (void)atomic_compare_exchange_strong(&omega_numeric_native_state, &expected, 430 -: 61: OMEGA_NUMERIC_NATIVE_IDLE); 431 8: 62:} 432 -: 63:#endif 433 -: 0:Source:src/omega_path_check.h 434 -: 0:Graph:build/leftovers/coverage/diff-leftovers_test.gcno 435 -: 0:Data:build/leftovers/coverage/diff-leftovers_test.gcda 436 -: 0:Runs:1 437 -: 1:/* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 438 -: 2: * Copyright 2026 Drake Stapleton (AIEN / aien-dev) 439 -: 3: * 440 -: 4: * omega_path_check.h: a checked copy of a file system path that came from outside the program (an 441 -: 5: * environment variable, a command's output, a caller's argument) before anything opens it. 442 -: 6: * 443 -: 7: * A path is accepted only when it is 1..cap-1 bytes long, every byte is in the POSIX portable file name set 444 -: 8: * [A-Za-z0-9._-] or one of / + , = @ : ~ (no space, quote, control, shell or non-ASCII byte), and no 445 -: 9: * component is "..". Absolute and relative paths are both accepted. The accepted path is copied byte by byte 446 -: 10: * through omega_path_byte, so the bytes the caller later opens are exactly the bytes that were checked. 447 -: 11: * A refused path leaves out as the empty string. 448 -: 12: */ 449 -: 13:#ifndef OMEGA_PATH_CHECK_H 450 -: 14:#define OMEGA_PATH_CHECK_H 451 -: 15: 452 -: 16:#include 453 -: 17:#include "cudapp_native.h" 454 -: 18: 455 -: 19:#if defined(CUDAPP_MIGRATION_PENDING_LEFTOVERS) && CUDAPP_MIGRATION_PENDING_LEFTOVERS 456 -: 20: 457 -: 21:/* c when it may appear in a checked path, -1 otherwise */ 458 function oracle_path_byte called 2619 returned 100% blocks executed 100% 459 2619: 22:static inline int omega_path_byte(int c) { 460 2619: 23: if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9')) return c; 461 branch 0 taken 923 (fallthrough) 462 branch 1 taken 1696 463 branch 2 taken 284 (fallthrough) 464 branch 3 taken 639 465 branch 4 taken 436 (fallthrough) 466 branch 5 taken 1544 467 branch 6 taken 321 (fallthrough) 468 branch 7 taken 115 469 branch 8 taken 467 (fallthrough) 470 branch 9 taken 1398 471 branch 10 taken 75 (fallthrough) 472 branch 11 taken 392 473 1790: 24: switch (c) { 474 branch 0 taken 1359 475 branch 1 taken 431 476 1359: 25: case '.': case '_': case '-': case '/': case '+': case ',': case '=': case '@': case ':': case '~': 477 1359: 26: return c; 478 431: 27: default: 479 431: 28: return -1; 480 -: 29: } 481 -: 30:} 482 -: 31: 483 -: 32:/* 0 with out = in when in is an acceptable path shorter than cap; -1 with out = "" otherwise */ 484 function oracle_path_copy called 883 returned 100% blocks executed 100% 485 883: 33:static inline int omega_path_copy(char *out, size_t cap, const char *in) { 486 883: 34: if (!out || cap == 0) return -1; 487 branch 0 taken 882 (fallthrough) 488 branch 1 taken 1 489 branch 2 taken 19 (fallthrough) 490 branch 3 taken 863 491 863: 35: out[0] = '\0'; 492 863: 36: if (!in || !in[0]) return -1; 493 branch 0 taken 831 (fallthrough) 494 branch 1 taken 32 495 branch 2 taken 32 (fallthrough) 496 branch 3 taken 799 497 799: 37: size_t k = 0; 498 2847: 38: for (; in[k]; k++) { 499 branch 0 taken 2361 500 branch 1 taken 486 (fallthrough) 501 2361: 39: int b = omega_path_byte((unsigned char)in[k]); 502 call 0 returned 2361 503 2361: 40: if (b < 0 || k + 1 >= cap) { 504 branch 0 taken 2116 (fallthrough) 505 branch 1 taken 245 506 branch 2 taken 68 (fallthrough) 507 branch 3 taken 2048 508 313: 41: out[0] = '\0'; 509 313: 42: return -1; 510 -: 43: } 511 2048: 44: out[k] = (char)b; 512 -: 45: } 513 486: 46: out[k] = '\0'; 514 1144: 47: for (size_t i = 0; i < k;) { 515 branch 0 taken 800 516 branch 1 taken 344 (fallthrough) 517 800: 48: size_t j = i; 518 2129: 49: while (j < k && out[j] != '/') j++; 519 branch 0 taken 1756 (fallthrough) 520 branch 1 taken 373 521 branch 2 taken 1329 522 branch 3 taken 427 (fallthrough) 523 800: 50: if (j - i == 2 && out[i] == '.' && out[i + 1] == '.') { 524 branch 0 taken 213 (fallthrough) 525 branch 1 taken 587 526 branch 2 taken 143 (fallthrough) 527 branch 3 taken 70 528 branch 4 taken 142 (fallthrough) 529 branch 5 taken 1 530 142: 51: out[0] = '\0'; 531 142: 52: return -1; 532 -: 53: } 533 658: 54: i = j + 1; 534 -: 55: } 535 344: 56: return 0; 536 -: 57:} 537 -: 58:#else 538 -: 59:/* Pointer custody and stores stay here; the scalar Omega transducer owns 539 -: 60: * alphabet, component and length decisions. No fixed-size path truncation. */ 540 function omega_path_byte called 258 returned 100% blocks executed 89% 541 258: 61:static inline int omega_path_byte(int c) { 542 258: 62: uint64_t value = 256; 543 258: 63: if (omega_leftovers(&value, 0, (uint64_t)(int64_t)c, 0, 0, 0) != OMEGA_OK) 544 call 0 returned 258 545 branch 1 taken 0 (fallthrough) 546 branch 2 taken 258 547 #####: 64: return -1; 548 258: 65: return value == 256 ? -1 : (int)value; 549 branch 0 taken 72 (fallthrough) 550 branch 1 taken 186 551 -: 66:} 552 function omega_path_copy called 883 returned 100% blocks executed 100% 553 883: 67:static inline int omega_path_copy(char *out, size_t cap, const char *in) { 554 883: 68: if (!out || cap == 0) return -1; 555 branch 0 taken 882 (fallthrough) 556 branch 1 taken 1 557 branch 2 taken 19 (fallthrough) 558 branch 3 taken 863 559 863: 69: out[0] = '\0'; 560 863: 70: if (!in) return -1; 561 branch 0 taken 32 (fallthrough) 562 branch 1 taken 831 563 831: 71: uint64_t state = 0; 564 831: 72: for (size_t k = 0;; ++k) { 565 2797: 73: unsigned char value = (unsigned char)in[k]; 566 2797: 74: uint64_t next = 4; 567 2797: 75: if (omega_leftovers(&next, 1, state, value, k, cap) != OMEGA_OK || 568 call 0 returned 2797 569 branch 1 taken 2797 (fallthrough) 570 branch 2 taken 0 571 2797: 76: next == 4) { 572 branch 0 taken 487 (fallthrough) 573 branch 1 taken 2310 574 487: 77: out[0] = '\0'; 575 831: 78: return -1; 576 -: 79: } 577 2310: 80: out[k] = (char)value; 578 2310: 81: if (next == 5) return 0; 579 branch 0 taken 344 (fallthrough) 580 branch 1 taken 1966 581 1966: 82: state = next; 582 -: 83: } 583 -: 84:} 584 -: 85:#endif 585 -: 86: 586 -: 87:#endif /* OMEGA_PATH_CHECK_H */ 587 588 rc=0