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/2026-11-06-costmodel-rest/rx_cm_sort.h.gcov # 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 / 2026-11-06-costmodel-rest / rx_cm_sort.h.gcov` 77 lines · 4076 bytes Raw Blame History 1 -: 0:Source:src/runtime/rx_cm_sort.h 2 -: 0:Graph:/tmp/cm-full-cov-v5qvhlky/oracle.gcno 3 -: 0:Data:/tmp/cm-full-cov-v5qvhlky/oracle.gcda 4 -: 0:Runs:2 5 -: 1:/* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception */ 6 -: 2:#ifndef RX_CM_SORT_H 7 -: 3:#define RX_CM_SORT_H 8 -: 4:#include "cudapp_native.h" 9 -: 5:#include 10 -: 6:#include 11 -: 7:#ifndef CUDAPP_MIGRATION_PENDING_C_CM_SORT 12 -: 8:#define CUDAPP_MIGRATION_PENDING_C_CM_SORT 0 13 -: 9:#endif 14 -: 10:#if CUDAPP_MIGRATION_PENDING_C_CM_SORT 15 -: 11:/* Total comparator: resolves formerly unspecified NaN and signed-zero ties. */ 16 function rx_cm_cmp called 2083 returned 100% blocks executed 67% 17 2083: 12:static int rx_cm_cmp(const void *pa, const void *pb) { 18 -: 13: double a, b; uint64_t ab, bb; 19 2083: 14: memcpy(&a,pa,8); memcpy(&b,pb,8); memcpy(&ab,pa,8); memcpy(&bb,pb,8); 20 2083*: 15: if (a != a) { if (b == b) return 1; } 21 branch 0 taken 0 (fallthrough) 22 branch 1 taken 2083 23 branch 2 never executed (fallthrough) 24 branch 3 never executed 25 2083*: 16: else { if (b != b) return -1; if (a < b) return -1; if (a > b) return 1; } 26 branch 0 taken 0 (fallthrough) 27 branch 1 taken 2083 28 branch 2 taken 994 (fallthrough) 29 branch 3 taken 1089 30 branch 4 taken 1089 (fallthrough) 31 branch 5 taken 0 32 #####: 17: return (ab > bb) - (ab < bb); 33 -: 18:} 34 -: 19:#endif 35 function rx_cm_sort called 1 returned 100% blocks executed 100% 36 1: 20:static inline int rx_cm_sort(double *values, size_t n) { 37 -: 21:#if CUDAPP_MIGRATION_PENDING_C_CM_SORT 38 1: 22: qsort(values,n,sizeof *values,rx_cm_cmp); return 0; 39 call 0 returned 1 40 -: 23:#else 41 -: 24: if (n < 2) return 0; 42 -: 25: if (n > SIZE_MAX / sizeof *values) return -1; 43 -: 26: uint64_t left[256]={0}, right[256]={0}, out[256]={0}, meta[4]={0}, done; 44 -: 27: for (size_t i=0;i256 || meta[2]>na || meta[3]>nb || done!=meta[2]+meta[3]) { free(scratch);return -1; } 64 -: 47: memcpy(dst+k,out,(size_t)done*sizeof *values); 65 -: 48: a+=(size_t)meta[2];b+=(size_t)meta[3];k+=(size_t)done; 66 -: 49: } 67 -: 50: start=end; 68 -: 51: } 69 -: 52: double *swap=src;src=dst;dst=swap; 70 -: 53: if(width>n/2)break; 71 -: 54: width*=2; 72 -: 55: } 73 -: 56: if(src!=values)memcpy(values,src,n*sizeof *values); 74 -: 57: free(scratch);return 0; 75 -: 58:#endif 76 -: 59:} 77 -: 60:#endif