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 / 2026-11-06-codegen-base / oracle-ir.gcov
| 1 | -: 0:Source:src/omega_gpu_om_ir.c |
| 2 | -: 0:Graph:~/work/cudastack/lanes/CodegenBaseOm/build/codegen-base-om/oracle_ir.gcno |
| 3 | -: 0:Data:~/work/cudastack/lanes/CodegenBaseOm/build/codegen-base-om/oracle_ir.gcda |
| 4 | -: 0:Runs:1 |
| 5 | -: 1:/* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception */ |
| 6 | -: 2:/* ARCH-0042 ABI/replay dispatch shell; wire admission and lifetime policy are seeded Omega. */ |
| 7 | -: 3:#include "omega_gpu_om_ir.h" |
| 8 | -: 4: |
| 9 | -: 5:#include <string.h> |
| 10 | -: 6: |
| 11 | -: 7:#include "cudapp_native.h" |
| 12 | -: 8:#include "omega_bw_fields.h" |
| 13 | -: 9: |
| 14 | -: 10:#define NONE64 UINT64_MAX |
| 15 | -: 11: |
| 16 | -: 12:#ifdef CUDAPP_MIGRATION_PENDING_C_CODEGEN_BASE |
| 17 | function field called 158782 returned 100% blocks executed 100% |
| 18 | 158782: 13:static int field(uint64_t w, int *out) { |
| 19 | 158782: 14: if (w == NONE64) { *out = -1; return 0; } |
| 20 | branch 0 taken 65482 (fallthrough) |
| 21 | branch 1 taken 93300 |
| 22 | 93300: 15: if (w >= (uint64_t)BW_MAX_VREGS) return -1; |
| 23 | branch 0 taken 12 (fallthrough) |
| 24 | branch 1 taken 93288 |
| 25 | 93288: 16: *out = (int)w; |
| 26 | 93288: 17: return 0; |
| 27 | -: 18:} |
| 28 | -: 19:#endif |
| 29 | -: 20: |
| 30 | function call_unit called 4 returned 100% blocks executed 78% |
| 31 | 4: 21:static int call_unit(uint64_t kind, uint64_t a, uint64_t b, uint64_t c, uint64_t *ins, uint64_t *meta, |
| 32 | -: 22: uint64_t *result) { |
| 33 | 4: 23: *result = 0; |
| 34 | 4: 24: if (omega_mathlibs_ir(result, kind, a, b, c, ins, OMEGA_OM_IR_WORDS, meta, OMEGA_OM_IR_META) != OMEGA_OK) |
| 35 | call 0 returned 4 |
| 36 | branch 1 taken 0 (fallthrough) |
| 37 | branch 2 taken 4 |
| 38 | #####: 25: return OMEGA_OM_IR_BRIDGE; |
| 39 | 4: 26: if (*result == 1) return OMEGA_OM_IR_REFUSED; |
| 40 | branch 0 taken 1 (fallthrough) |
| 41 | branch 1 taken 3 |
| 42 | 3*: 27: if (*result != 0) return OMEGA_OM_IR_EMIT; |
| 43 | branch 0 taken 0 (fallthrough) |
| 44 | branch 1 taken 3 |
| 45 | 3: 28: return OMEGA_OM_IR_OK; |
| 46 | -: 29:} |
| 47 | -: 30: |
| 48 | function legacy_omega_gpu_om_ir_data called 5 returned 100% blocks executed 100% |
| 49 | 5: 31:int omega_gpu_om_ir_data(uint64_t kind, uint64_t a, uint64_t b, uint64_t c, uint64_t *words) { |
| 50 | -: 32: static uint64_t meta[OMEGA_OM_IR_META]; |
| 51 | -: 33: uint64_t result; |
| 52 | 5: 34: if (!words) return OMEGA_OM_IR_REPLAY; |
| 53 | branch 0 taken 1 (fallthrough) |
| 54 | branch 1 taken 4 |
| 55 | 4: 35: memset(words, 0, OMEGA_OM_IR_WORDS * sizeof *words); |
| 56 | 4: 36: return call_unit(kind, a, b, c, words, meta, &result); |
| 57 | call 0 returned 4 |
| 58 | -: 37:} |
| 59 | -: 38: |
| 60 | -: 39:#ifdef CUDAPP_MIGRATION_PENDING_C_CODEGEN_BASE |
| 61 | -: 40:/* The elementwise emitter's check (src/omega_gpu_elementwise_api.c check_loop_invariant): no value first defined |
| 62 | -: 41: * inside a loop may be read after the loop before it is redefined. */ |
| 63 | function loop_invariant_ok called 511 returned 100% blocks executed 100% |
| 64 | 511: 42:static int loop_invariant_ok(const BlackwellIRProgram *p, const uint64_t *meta) { |
| 65 | 511: 43: const OmegaRegAlloc *ra = &p->regalloc; |
| 66 | 693: 44: for (uint64_t L = 0; L < meta[5]; L++) { |
| 67 | branch 0 taken 187 |
| 68 | branch 1 taken 506 (fallthrough) |
| 69 | 187: 45: int start = (int)meta[16 + 2 * L], end = (int)meta[17 + 2 * L]; |
| 70 | 12536: 46: for (int v = 0; v < ra->num_vregs; v++) { |
| 71 | branch 0 taken 12354 |
| 72 | branch 1 taken 182 (fallthrough) |
| 73 | 12354: 47: int fd = ra->intervals[v].first_def; |
| 74 | 12354: 48: if (fd < start || fd > end) continue; |
| 75 | branch 0 taken 3535 (fallthrough) |
| 76 | branch 1 taken 8819 |
| 77 | branch 2 taken 1655 (fallthrough) |
| 78 | branch 3 taken 1880 |
| 79 | 19906: 49: for (size_t i = (size_t)end + 1; i < p->count; i++) { |
| 80 | branch 0 taken 18033 |
| 81 | branch 1 taken 1873 (fallthrough) |
| 82 | 18033: 50: const BlackwellIRInsn *in = &p->insns[i]; |
| 83 | 18033: 51: if (in->src1_vreg == v || in->src2_vreg == v || in->src3_vreg == v) return 0; |
| 84 | branch 0 taken 18030 (fallthrough) |
| 85 | branch 1 taken 3 |
| 86 | branch 2 taken 18029 (fallthrough) |
| 87 | branch 3 taken 1 |
| 88 | branch 4 taken 1 (fallthrough) |
| 89 | branch 5 taken 18028 |
| 90 | 18028: 52: if (in->dst_vreg == v && !in->is_uniform) break; |
| 91 | branch 0 taken 3 (fallthrough) |
| 92 | branch 1 taken 18025 |
| 93 | branch 2 taken 2 (fallthrough) |
| 94 | branch 3 taken 1 |
| 95 | -: 53: } |
| 96 | -: 54: } |
| 97 | -: 55: } |
| 98 | 506: 56: return 1; |
| 99 | -: 57:} |
| 100 | -: 58: |
| 101 | -: 59:/* A value live into a loop and read inside it is read again by every later iteration: hold it to the closing BRA |
| 102 | -: 60: * (the elementwise emitter's loop_end fixup). */ |
| 103 | function extend_loop called 188 returned 100% blocks executed 100% |
| 104 | 188: 61:static void extend_loop(BlackwellIRProgram *p, int start, int end) { |
| 105 | 12542: 62: for (int v = 0; v < p->regalloc.num_vregs; v++) { |
| 106 | branch 0 taken 12354 |
| 107 | branch 1 taken 188 (fallthrough) |
| 108 | 12354: 63: OmegaLiveInterval *iv = &p->regalloc.intervals[v]; |
| 109 | 12354: 64: if (iv->first_def >= 0 && iv->first_def < start && iv->last_use >= start && iv->last_use < end) |
| 110 | branch 0 taken 10659 (fallthrough) |
| 111 | branch 1 taken 1695 |
| 112 | branch 2 taken 8789 (fallthrough) |
| 113 | branch 3 taken 1870 |
| 114 | branch 4 taken 1059 (fallthrough) |
| 115 | branch 5 taken 7730 |
| 116 | branch 6 taken 1058 (fallthrough) |
| 117 | branch 7 taken 1 |
| 118 | 1058: 65: iv->last_use = end; |
| 119 | -: 66: } |
| 120 | 188: 67:} |
| 121 | -: 68: |
| 122 | function legacy_omega_gpu_om_ir_replay called 1141 returned 100% blocks executed 96% |
| 123 | 1141: 69:int omega_gpu_om_ir_replay(OmegaOmIrUnit unit, uint64_t kind, uint64_t a, uint64_t b, uint64_t c, |
| 124 | -: 70: BlackwellIRProgram *prog, uint64_t *emit_err) { |
| 125 | 1141: 71: uint64_t ins[OMEGA_OM_IR_WORDS] = {0}, meta[OMEGA_OM_IR_META] = {0}; |
| 126 | 1141: 72: uint64_t result = 0; |
| 127 | 1141: 73: if (emit_err) *emit_err = 0; |
| 128 | branch 0 taken 1141 (fallthrough) |
| 129 | branch 1 taken 0 |
| 130 | 1141*: 74: if (!unit || !prog) return OMEGA_OM_IR_REPLAY; |
| 131 | branch 0 taken 1141 (fallthrough) |
| 132 | branch 1 taken 0 |
| 133 | branch 2 taken 0 (fallthrough) |
| 134 | branch 3 taken 1141 |
| 135 | 1141: 75: uint32_t status = unit(&result, kind, a, b, c, ins, OMEGA_OM_IR_WORDS, meta, OMEGA_OM_IR_META); |
| 136 | call 0 returned 1141 |
| 137 | 1141: 76: if (emit_err) *emit_err = meta[4]; |
| 138 | branch 0 taken 1141 (fallthrough) |
| 139 | branch 1 taken 0 |
| 140 | 1141: 77: if (status != OMEGA_OK) return OMEGA_OM_IR_BRIDGE; |
| 141 | branch 0 taken 3 (fallthrough) |
| 142 | branch 1 taken 1138 |
| 143 | 1138: 78: if (result == 1) return OMEGA_OM_IR_REFUSED; |
| 144 | branch 0 taken 407 (fallthrough) |
| 145 | branch 1 taken 731 |
| 146 | 731: 79: if (result != 0) return OMEGA_OM_IR_EMIT; |
| 147 | branch 0 taken 2 (fallthrough) |
| 148 | branch 1 taken 729 |
| 149 | 729: 80: uint64_t n = meta[0]; |
| 150 | 729: 81: if (n == 0 || n > BW_MAX_IR_INSNS || meta[1] > BW_MAX_VREGS || meta[2] > BW_MAX_UVREGS || meta[5] > 24) |
| 151 | branch 0 taken 588 (fallthrough) |
| 152 | branch 1 taken 141 |
| 153 | branch 2 taken 586 (fallthrough) |
| 154 | branch 3 taken 2 |
| 155 | branch 4 taken 584 (fallthrough) |
| 156 | branch 5 taken 2 |
| 157 | branch 6 taken 582 (fallthrough) |
| 158 | branch 7 taken 2 |
| 159 | branch 8 taken 2 (fallthrough) |
| 160 | branch 9 taken 580 |
| 161 | 149: 82: return OMEGA_OM_IR_REPLAY; |
| 162 | 580: 83: if (meta[6] != 0 && |
| 163 | branch 0 taken 8 (fallthrough) |
| 164 | branch 1 taken 572 |
| 165 | 8: 84: (meta[6] <= (uint64_t)BW_PHYS_GPR_MAX || meta[6] > (uint64_t)BW_PHYS_GPR_HW_LIMIT)) |
| 166 | branch 0 taken 5 (fallthrough) |
| 167 | branch 1 taken 3 |
| 168 | branch 2 taken 2 (fallthrough) |
| 169 | branch 3 taken 3 |
| 170 | 5: 85: return OMEGA_OM_IR_REPLAY; |
| 171 | 575: 86: if (meta[7] != 0) { |
| 172 | branch 0 taken 12 (fallthrough) |
| 173 | branch 1 taken 563 |
| 174 | 12: 87: uint64_t check = 0; |
| 175 | 12: 88: if (omega_ra_live(&check, 0, meta[7], meta[1], 0, 0, 0) != 0) |
| 176 | call 0 returned 12 |
| 177 | branch 1 taken 0 (fallthrough) |
| 178 | branch 2 taken 12 |
| 179 | 3*: 89: return OMEGA_OM_IR_BRIDGE; |
| 180 | 12: 90: if (check != 0) return (int)check; |
| 181 | branch 0 taken 3 (fallthrough) |
| 182 | branch 1 taken 9 |
| 183 | -: 91: } |
| 184 | -: 92: |
| 185 | 572: 93: omega_bw_ir_init(prog); |
| 186 | call 0 returned 572 |
| 187 | 572: 94: if (meta[6] != 0 && omega_bw_ir_set_gpr_limit(prog, (uint32_t)meta[6]) != 0) |
| 188 | branch 0 taken 3 (fallthrough) |
| 189 | branch 1 taken 569 |
| 190 | call 2 returned 3 |
| 191 | branch 3 taken 0 (fallthrough) |
| 192 | branch 4 taken 3 |
| 193 | #####: 95: return OMEGA_OM_IR_REPLAY; |
| 194 | 18815: 96: for (uint64_t v = 0; v < meta[1]; v++) { |
| 195 | branch 0 taken 18247 |
| 196 | branch 1 taken 568 (fallthrough) |
| 197 | 18247: 97: uint64_t k = meta[64 + v]; |
| 198 | 36493: 98: int got = k == 4 ? omega_bw_ir_alloc_vreg128(prog) : |
| 199 | branch 0 taken 1 (fallthrough) |
| 200 | branch 1 taken 18246 |
| 201 | call 2 returned 1 |
| 202 | 18246: 99: k == 2 ? omega_bw_ir_alloc_vreg64(prog) : k == 1 ? omega_bw_ir_alloc_vreg(prog) : -1; |
| 203 | branch 0 taken 3571 (fallthrough) |
| 204 | branch 1 taken 14675 |
| 205 | call 2 returned 3571 |
| 206 | branch 3 taken 14671 (fallthrough) |
| 207 | branch 4 taken 4 |
| 208 | call 5 returned 14671 |
| 209 | 18247: 100: if (got != (int)v) return OMEGA_OM_IR_REPLAY; |
| 210 | branch 0 taken 4 (fallthrough) |
| 211 | branch 1 taken 18243 |
| 212 | -: 101: } |
| 213 | 818: 102: for (uint64_t u = 0; u < meta[2]; u++) { |
| 214 | branch 0 taken 255 |
| 215 | branch 1 taken 563 (fallthrough) |
| 216 | 255: 103: uint64_t k = meta[320 + u]; |
| 217 | 255: 104: int got = k == 2 ? omega_bw_ir_alloc_uvreg64(prog) : k == 1 ? omega_bw_ir_alloc_uvreg(prog) : -1; |
| 218 | branch 0 taken 183 (fallthrough) |
| 219 | branch 1 taken 72 |
| 220 | call 2 returned 183 |
| 221 | branch 3 taken 67 (fallthrough) |
| 222 | branch 4 taken 5 |
| 223 | call 5 returned 67 |
| 224 | 255: 105: if (got != (int)u) return OMEGA_OM_IR_REPLAY; |
| 225 | branch 0 taken 5 (fallthrough) |
| 226 | branch 1 taken 250 |
| 227 | -: 106: } |
| 228 | -: 107: |
| 229 | 563: 108: uint64_t next_loop = 0; |
| 230 | 40244: 109: for (uint64_t i = 0; i < n; i++) { |
| 231 | branch 0 taken 39702 |
| 232 | branch 1 taken 542 (fallthrough) |
| 233 | 39702: 110: const uint64_t *r = &ins[i * 8]; |
| 234 | -: 111: BlackwellIRInsn in; |
| 235 | 39702: 112: memset(&in, 0, sizeof in); |
| 236 | 39721: 113: if (r[0] > (uint64_t)BW_IR_ATOMG_ADD_F32_STRONG_GPU) return OMEGA_OM_IR_REPLAY; |
| 237 | branch 0 taken 2 (fallthrough) |
| 238 | branch 1 taken 39700 |
| 239 | 39700: 114: in.op = (BlackwellIROpcode)r[0]; |
| 240 | 79391: 115: if (field(r[1], &in.dst_vreg) || field(r[2], &in.src1_vreg) || field(r[3], &in.src2_vreg) || |
| 241 | call 0 returned 39700 |
| 242 | branch 1 taken 39697 (fallthrough) |
| 243 | branch 2 taken 3 |
| 244 | call 3 returned 39697 |
| 245 | branch 4 taken 39694 (fallthrough) |
| 246 | branch 5 taken 3 |
| 247 | call 6 returned 39694 |
| 248 | branch 7 taken 39691 (fallthrough) |
| 249 | branch 8 taken 3 |
| 250 | branch 9 taken 3 (fallthrough) |
| 251 | branch 10 taken 39688 |
| 252 | 39691: 116: field(r[4], &in.src3_vreg)) |
| 253 | call 0 returned 39691 |
| 254 | 12: 117: return OMEGA_OM_IR_REPLAY; |
| 255 | 39688: 118: if (r[5] == NONE64) in.ureg = -1; |
| 256 | branch 0 taken 36891 (fallthrough) |
| 257 | branch 1 taken 2797 |
| 258 | 2797: 119: else if (r[5] < (uint64_t)BW_MAX_UVREGS) in.ureg = (int)r[5]; |
| 259 | branch 0 taken 2790 (fallthrough) |
| 260 | branch 1 taken 7 |
| 261 | 7: 120: else return OMEGA_OM_IR_REPLAY; |
| 262 | 39681: 121: in.imm = (uint32_t)r[6]; |
| 263 | 39681: 122: in.control = (uint32_t)(r[6] >> 32); |
| 264 | 39681: 123: in.is_uniform = (r[7] & 1u) != 0; |
| 265 | 39681: 124: in.predicate_p0 = (r[7] & 2u) != 0; |
| 266 | 39681: 125: in.predicate_not = (r[7] & 4u) != 0; |
| 267 | 39681: 126: in.dst_subreg = (uint8_t)(r[7] >> 16); |
| 268 | 39681: 127: in.src1_subreg = (uint8_t)(r[7] >> 24); |
| 269 | 39681: 128: in.src2_subreg = (uint8_t)(r[7] >> 32); |
| 270 | 39681: 129: in.src3_subreg = (uint8_t)(r[7] >> 40); |
| 271 | 39681: 130: in.bar_reg = (uint8_t)(r[7] >> 48); |
| 272 | 39681*: 131: if (omega_bw_ir_append(prog, &in) < 0) return OMEGA_OM_IR_REPLAY; |
| 273 | call 0 returned 39681 |
| 274 | branch 1 taken 0 (fallthrough) |
| 275 | branch 2 taken 39681 |
| 276 | 39869: 132: while (next_loop < meta[5] && meta[17 + 2 * next_loop] == i) { |
| 277 | branch 0 taken 8101 (fallthrough) |
| 278 | branch 1 taken 31768 |
| 279 | branch 2 taken 188 |
| 280 | branch 3 taken 7913 (fallthrough) |
| 281 | 188: 133: extend_loop(prog, (int)meta[16 + 2 * next_loop], (int)i); |
| 282 | call 0 returned 188 |
| 283 | 188: 134: next_loop++; |
| 284 | -: 135: } |
| 285 | -: 136: } |
| 286 | 542: 137: if (next_loop != meta[5]) return OMEGA_OM_IR_REPLAY; |
| 287 | branch 0 taken 25 (fallthrough) |
| 288 | branch 1 taken 517 |
| 289 | 517: 138: if (meta[7] != 0) { |
| 290 | branch 0 taken 9 (fallthrough) |
| 291 | branch 1 taken 508 |
| 292 | 13: 139: for (int v = 0; v < prog->regalloc.num_vregs; ++v) { |
| 293 | branch 0 taken 8 |
| 294 | branch 1 taken 5 (fallthrough) |
| 295 | 8: 140: uint64_t hint = meta[352 + v], check = 0; |
| 296 | 8: 141: OmegaLiveInterval *iv = &prog->regalloc.intervals[v]; |
| 297 | 8: 142: if (omega_ra_live(&check, 1, hint, (uint64_t)iv->first_def, |
| 298 | branch 0 taken 0 (fallthrough) |
| 299 | branch 1 taken 8 |
| 300 | 8: 143: (uint64_t)iv->last_use, n, (uint64_t)v) != 0) |
| 301 | call 0 returned 8 |
| 302 | 4*: 144: return OMEGA_OM_IR_BRIDGE; |
| 303 | 8: 145: if (check != 0) return (int)check; |
| 304 | branch 0 taken 4 (fallthrough) |
| 305 | branch 1 taken 4 |
| 306 | 4: 146: if (hint != 0) iv->last_use = (int)hint; |
| 307 | branch 0 taken 3 (fallthrough) |
| 308 | branch 1 taken 1 |
| 309 | -: 147: } |
| 310 | -: 148: } |
| 311 | -: 149: |
| 312 | 513: 150: if (omega_bw_regalloc_solve(prog) != 0) return OMEGA_OM_IR_REGALLOC; |
| 313 | call 0 returned 513 |
| 314 | branch 1 taken 2 (fallthrough) |
| 315 | branch 2 taken 511 |
| 316 | 511: 151: if (!loop_invariant_ok(prog, meta)) return OMEGA_OM_IR_LOOP; |
| 317 | call 0 returned 511 |
| 318 | branch 1 taken 5 (fallthrough) |
| 319 | branch 2 taken 506 |
| 320 | 506: 152: return OMEGA_OM_IR_OK; |
| 321 | -: 153:} |
| 322 | -: 154:#else |
| 323 | -: 155:int omega_gpu_om_ir_replay(OmegaOmIrUnit unit, uint64_t kind, uint64_t a, uint64_t b, uint64_t c, |
| 324 | -: 156: BlackwellIRProgram *prog, uint64_t *emit_err) { |
| 325 | -: 157: uint64_t ins[OMEGA_OM_IR_WORDS] = {0}, meta[OMEGA_OM_IR_META] = {0}, life[512] = {0}; |
| 326 | -: 158: uint64_t result = 0; |
| 327 | -: 159: if (emit_err) *emit_err = 0; |
| 328 | -: 160: if (!unit || !prog) return OMEGA_OM_IR_REPLAY; |
| 329 | -: 161: uint32_t status = unit(&result, kind, a, b, c, ins, OMEGA_OM_IR_WORDS, meta, OMEGA_OM_IR_META); |
| 330 | -: 162: if (emit_err) *emit_err = meta[4]; |
| 331 | -: 163: if (status != OMEGA_OK) return OMEGA_OM_IR_BRIDGE; |
| 332 | -: 164: if (result == 1) return OMEGA_OM_IR_REFUSED; |
| 333 | -: 165: if (result != 0) return OMEGA_OM_IR_EMIT; |
| 334 | -: 166: if (omega_cg_replay(&result, ins, OMEGA_OM_IR_WORDS, meta, OMEGA_OM_IR_META, |
| 335 | -: 167: BW_IR_ATOMG_ADD_F32_STRONG_GPU) != OMEGA_OK) return OMEGA_OM_IR_BRIDGE; |
| 336 | -: 168: if (result != 0) return (int)result; |
| 337 | -: 169: omega_bw_ir_init(prog); |
| 338 | -: 170: if (meta[6] != 0 && omega_bw_ir_set_gpr_limit(prog, (uint32_t)meta[6]) != 0) |
| 339 | -: 171: return OMEGA_OM_IR_REPLAY; |
| 340 | -: 172: for (uint64_t v = 0; v < meta[1]; ++v) { |
| 341 | -: 173: uint64_t width = meta[64 + v]; |
| 342 | -: 174: int got = width == 4 ? omega_bw_ir_alloc_vreg128(prog) : |
| 343 | -: 175: width == 2 ? omega_bw_ir_alloc_vreg64(prog) : omega_bw_ir_alloc_vreg(prog); |
| 344 | -: 176: if (got != (int)v) return OMEGA_OM_IR_REPLAY; |
| 345 | -: 177: } |
| 346 | -: 178: for (uint64_t u = 0; u < meta[2]; ++u) { |
| 347 | -: 179: int got = meta[320 + u] == 2 ? omega_bw_ir_alloc_uvreg64(prog) : omega_bw_ir_alloc_uvreg(prog); |
| 348 | -: 180: if (got != (int)u) return OMEGA_OM_IR_REPLAY; |
| 349 | -: 181: } |
| 350 | -: 182: for (uint64_t i = 0; i < meta[0]; ++i) { |
| 351 | -: 183: BlackwellIRInsn in = {0}; |
| 352 | -: 184: if (omega_bw_fields_unpack(&ins[i * 8], &in) != 0) return OMEGA_OM_IR_BRIDGE; |
| 353 | -: 185: if (omega_bw_ir_append(prog, &in) < 0) return OMEGA_OM_IR_REPLAY; |
| 354 | -: 186: } |
| 355 | -: 187: for (int v = 0; v < prog->regalloc.num_vregs; ++v) { |
| 356 | -: 188: life[2 * v] = (uint64_t)(int64_t)prog->regalloc.intervals[v].first_def; |
| 357 | -: 189: life[2 * v + 1] = (uint64_t)(int64_t)prog->regalloc.intervals[v].last_use; |
| 358 | -: 190: } |
| 359 | -: 191: if (omega_cg_life(&result, meta, OMEGA_OM_IR_META, life, 512) != OMEGA_OK) return OMEGA_OM_IR_BRIDGE; |
| 360 | -: 192: if (result != 0) return (int)result; |
| 361 | -: 193: for (int v = 0; v < prog->regalloc.num_vregs; ++v) |
| 362 | -: 194: prog->regalloc.intervals[v].last_use = (int)(int64_t)life[2 * v + 1]; |
| 363 | -: 195: if (omega_bw_regalloc_solve(prog) != 0) return OMEGA_OM_IR_REGALLOC; |
| 364 | -: 196: if (omega_cg_invar(&result, ins, OMEGA_OM_IR_WORDS, meta, OMEGA_OM_IR_META, life, 512) != OMEGA_OK) |
| 365 | -: 197: return OMEGA_OM_IR_BRIDGE; |
| 366 | -: 198: return (int)result; |
| 367 | -: 199:} |
| 368 | -: 200:#endif |
| 369 | -: 201: |
| 370 | function legacy_omega_gpu_om_ir_build called 832 returned 100% blocks executed 100% |
| 371 | 832: 202:int omega_gpu_om_ir_build(uint64_t kind, uint64_t a, uint64_t b, uint64_t c, uint32_t threads, |
| 372 | -: 203: BlackwellIRProgram *prog, uint8_t *code, size_t code_cap, |
| 373 | -: 204: OmegaBlackwellKernel *kernel, uint32_t *declared, uint64_t *emit_err) { |
| 374 | 832: 205: if (!prog || !code || !kernel || !declared || threads == 0) return OMEGA_OM_IR_REPLAY; |
| 375 | branch 0 taken 832 (fallthrough) |
| 376 | branch 1 taken 0 |
| 377 | branch 2 taken 832 (fallthrough) |
| 378 | branch 3 taken 0 |
| 379 | branch 4 taken 832 (fallthrough) |
| 380 | branch 5 taken 0 |
| 381 | branch 6 taken 832 (fallthrough) |
| 382 | branch 7 taken 0 |
| 383 | branch 8 taken 104 (fallthrough) |
| 384 | branch 9 taken 728 |
| 385 | 728: 206: int rc = omega_gpu_om_ir_replay(omega_mathlibs_ir, kind, a, b, c, prog, emit_err); |
| 386 | call 0 returned 728 |
| 387 | 728: 207: if (rc != OMEGA_OM_IR_OK) return rc; |
| 388 | branch 0 taken 546 (fallthrough) |
| 389 | branch 1 taken 182 |
| 390 | 182: 208: uint32_t peak = prog->regalloc.peak_gpr_usage; |
| 391 | -: 209:#ifdef CUDAPP_MIGRATION_PENDING_C_CODEGEN_BASE |
| 392 | 182: 210: uint32_t decl = omega_bw_gpr_declared(peak); |
| 393 | call 0 returned 182 |
| 394 | 182: 211: if (decl < 64u) decl = 64u; |
| 395 | branch 0 taken 182 (fallthrough) |
| 396 | branch 1 taken 0 |
| 397 | 182: 212: if (peak > BW_PHYS_GPR_MAX || !omega_bw_gpr_declared_ok(decl, peak) || (uint64_t)decl * threads > 65536u) |
| 398 | branch 0 taken 182 (fallthrough) |
| 399 | branch 1 taken 0 |
| 400 | call 2 returned 182 |
| 401 | branch 3 taken 182 (fallthrough) |
| 402 | branch 4 taken 0 |
| 403 | branch 5 taken 52 (fallthrough) |
| 404 | branch 6 taken 130 |
| 405 | 52: 213: return OMEGA_OM_IR_BUDGET; |
| 406 | -: 214:#else |
| 407 | -: 215: uint64_t budget = 0; |
| 408 | -: 216: if (omega_cg_budget(&budget, peak, omega_bw_gpr_declared(peak), threads) != OMEGA_OK) |
| 409 | -: 217: return OMEGA_OM_IR_BRIDGE; |
| 410 | -: 218: if (budget == 0) return OMEGA_OM_IR_BUDGET; |
| 411 | -: 219: uint32_t decl = (uint32_t)budget; |
| 412 | -: 220:#endif |
| 413 | 130: 221: if (omega_blackwell_kernel_encode_into(prog, code, code_cap, kernel) != 0) return OMEGA_OM_IR_ENCODE; |
| 414 | call 0 returned 130 |
| 415 | branch 1 taken 65 (fallthrough) |
| 416 | branch 2 taken 65 |
| 417 | 65: 222: *declared = decl; |
| 418 | 65: 223: return OMEGA_OM_IR_OK; |
| 419 | -: 224:} |
| 420 | -: 225: |
| 421 | function legacy_omega_gpu_om_ir_rc_name called 14 returned 100% blocks executed 100% |
| 422 | 14: 226:const char *omega_gpu_om_ir_rc_name(int rc) { |
| 423 | 14: 227: switch (rc) { |
| 424 | branch 0 taken 1 |
| 425 | branch 1 taken 1 |
| 426 | branch 2 taken 1 |
| 427 | branch 3 taken 1 |
| 428 | branch 4 taken 1 |
| 429 | branch 5 taken 1 |
| 430 | branch 6 taken 1 |
| 431 | branch 7 taken 1 |
| 432 | branch 8 taken 1 |
| 433 | branch 9 taken 1 |
| 434 | branch 10 taken 1 |
| 435 | branch 11 taken 3 |
| 436 | 1: 228: case OMEGA_OM_IR_OK: return "ok"; |
| 437 | 1: 229: case OMEGA_OM_IR_REFUSED: return "refused"; |
| 438 | 1: 230: case OMEGA_OM_IR_EMIT: return "emit"; |
| 439 | 1: 231: case OMEGA_OM_IR_BRIDGE: return "bridge"; |
| 440 | 1: 232: case OMEGA_OM_IR_REPLAY: return "replay"; |
| 441 | 1: 233: case OMEGA_OM_IR_REGALLOC: return "regalloc"; |
| 442 | 1: 234: case OMEGA_OM_IR_LOOP: return "loop"; |
| 443 | 1: 235: case OMEGA_OM_IR_BUDGET: return "budget"; |
| 444 | 1: 236: case OMEGA_OM_IR_ENCODE: return "encode"; |
| 445 | 1: 237: case OMEGA_OM_IR_LIVE_FLAG: return "liveness-flag"; |
| 446 | 1: 238: case OMEGA_OM_IR_LIVE_RANGE: return "liveness-range"; |
| 447 | 3: 239: default: return "?"; |
| 448 | -: 240: } |
| 449 | -: 241:} |