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/seed/ng/physics/pareto_bank.om # 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 / seed / ng / physics / pareto_bank.om` 297 lines ยท 6700 bytes Raw Blame History 1 note SPDX-License-Identifier: Apache-2.0 2 note seed/ng/physics/pareto_bank.om 3 note Sovereign Intelligence 2.0 Stage 3 (Pillar 3: Physics-Typed Computing) 4 note Pareto Realization Bank: registers multiple proof-bounded realizations per SEMANTIC_ID 5 note across precisions and targets (FP64, FP32, BF16, FP8, NVFP4, CPU_X925, CPU_A725, SM121, 6 note ARBORIS_SHORTCUT). Enforces proof_mask == 7 (Contract | EGP3 | Antibody) before admission. 7 note 8 note Compose after: 9 note si/directives/om2.om 10 note apps/omega-wattd/watt_sense.om 11 note apps/omega-wattd/watt_cbf.om 12 note seed/ng/target/target_desc.om 13 note seed/ng/target/isel.om 14 note seed/ng/target/sm121_pe.om 15 note seed/ng/target/fabric.om 16 17 const PB_CAP ulong 64 18 const PB_NONE ulong 999999 19 20 note Proof-gate bitmask: bit0=Contract, bit1=EGP3, bit2=Antibody; ALL 3 bits required (== 7) 21 const PB_PROOF_CONTRACT ulong 1 22 const PB_PROOF_EGP3 ulong 2 23 const PB_PROOF_ANTIBODY ulong 4 24 const PB_PROOF_REQUIRED ulong 7 25 26 note Precision / realization profile IDs 27 const PB_PREC_FP64 ulong 1 28 const PB_PREC_FP32 ulong 2 29 const PB_PREC_BF16 ulong 3 30 const PB_PREC_FP8 ulong 4 31 const PB_PREC_NVFP4 ulong 5 32 const PB_PREC_CPU_X925 ulong 6 33 const PB_PREC_CPU_A725 ulong 7 34 const PB_PREC_SM121 ulong 8 35 const PB_PREC_ARBORIS_SHORTCUT ulong 9 36 37 note Registration status / refusal codes 38 const PB_OK ulong 0 39 const PB_ERR_PROOF_MASK ulong 1 40 const PB_ERR_BAD_SEM ulong 2 41 const PB_ERR_BAD_TARGET ulong 3 42 const PB_ERR_BAD_PREC ulong 4 43 const PB_ERR_BAD_METRICS ulong 5 44 const PB_ERR_BAD_PTR ulong 6 45 const PB_ERR_FULL ulong 7 46 47 note Bank storage (struct-of-arrays, 64 proof-bounded realizations) 48 global pb_used ulong 64 49 global pb_sem ulong 64 50 global pb_tid ulong 64 51 global pb_prec ulong 64 52 global pb_power_mw long 64 53 global pb_lat_us long 64 54 global pb_joules_uj long 64 55 global pb_err_bound long 64 56 global pb_proof ulong 64 57 global pb_code_ptr ulong 64 58 global pb_work_bits long 64 59 global pb_count ulong 1 60 global pb_rej_proof ulong 1 61 62 note Staging area for registering a realization (avoids >6 parameter slots) 63 note u64 staging: [0]=sem_id [1]=target_tid [2]=precision_id [3]=proof_mask [4]=code_ptr 64 global pb_st_u ulong 8 65 note i64 staging: [0]=est_power_mw [1]=est_latency_us [2]=est_joules_uj [3]=proven_err_bound [4]=work_bits 66 global pb_st_i long 8 67 global pb_last_idx ulong 1 68 69 fn pb_init to void 70 for i ulong PB_CAP 71 put pb_used i 0 72 put pb_sem i 0 73 put pb_tid i 0 74 put pb_prec i 0 75 put pb_power_mw i 0 76 put pb_lat_us i 0 77 put pb_joules_uj i 0 78 put pb_err_bound i 0 79 put pb_proof i 0 80 put pb_code_ptr i 0 81 put pb_work_bits i 0 82 end 83 put pb_count 0 0 84 put pb_rej_proof 0 0 85 put pb_last_idx 0 PB_NONE 86 end 87 88 note Derive 64-bit bank SEMANTIC_ID key from the first 8 LE bytes of a 32-byte SHA-256 SEMANTIC_ID 89 fn pb_sem_key_from_sha256 dig view uchar * to ulong 90 if lt len dig 8 91 ret 0 92 end 93 v = ulong 0 94 for i ulong 8 95 b = ulong get dig i 96 v = or v shl b mul i 8 97 end 98 ret v 99 end 100 101 note True iff target_tid executes on the GPU power rail (SM121 / coherent GB10 GPU / Spark Ring) 102 fn pb_is_gpu_target tid ulong to bool 103 if eq tid TID_SM121 104 ret true 105 end 106 if eq tid TID_APU_GB10 107 ret true 108 end 109 if eq tid TID_SPARK_RING 110 ret true 111 end 112 ret false 113 end 114 115 note Map (target_tid, precision_id) to fabric.om dispatch mode 116 fn pb_mode_for_realization tid ulong prec ulong to ulong 117 if eq prec PB_PREC_ARBORIS_SHORTCUT 118 ret FAB_MODE_CRYSTALLIZED 119 end 120 if pb_is_gpu_target tid 121 ret FAB_MODE_GPU_NATIVE 122 end 123 ret FAB_MODE_CPU_NATIVE 124 end 125 126 note Conservative microjoule estimate from mW and us: ceil(power_mw * lat_us / 1000) 127 note 1 mW * 1 us = 1 nJ = 1/1000 uJ 128 fn pb_calc_joules_uj power_mw long lat_us long to long 129 if or le power_mw 0 le lat_us 0 130 ret 0 131 end 132 if gt power_mw `1000000000` 133 ret 0 134 end 135 if gt lat_us `1000000000` 136 ret 0 137 end 138 nj = mul power_mw lat_us 139 ret wc_ceil_div nj 1000 140 end 141 142 note Stage identity & proof fields for pb_commit 143 fn pb_stage_id sem_id ulong tid ulong prec ulong proof_mask ulong code_ptr ulong to void 144 put pb_st_u 0 sem_id 145 put pb_st_u 1 tid 146 put pb_st_u 2 prec 147 put pb_st_u 3 proof_mask 148 put pb_st_u 4 code_ptr 149 end 150 151 note Stage physical & accuracy metrics for pb_commit 152 fn pb_stage_phys power_mw long lat_us long joules_uj long err_bound long work_bits long to void 153 put pb_st_i 0 power_mw 154 put pb_st_i 1 lat_us 155 put pb_st_i 2 joules_uj 156 put pb_st_i 3 err_bound 157 put pb_st_i 4 work_bits 158 end 159 160 note Admit the staged realization into the bank; strictly enforces proof_mask == 7! 161 fn pb_commit to ulong 162 put pb_last_idx 0 PB_NONE 163 if ne get pb_st_u 3 PB_PROOF_REQUIRED 164 put pb_rej_proof 0 add get pb_rej_proof 0 1 165 ret PB_ERR_PROOF_MASK 166 end 167 if eq get pb_st_u 0 0 168 ret PB_ERR_BAD_SEM 169 end 170 if ge get pb_st_u 1 TD_MAX_TARGETS 171 ret PB_ERR_BAD_TARGET 172 end 173 prec = get pb_st_u 2 174 if lt prec PB_PREC_FP64 175 ret PB_ERR_BAD_PREC 176 end 177 if gt prec PB_PREC_ARBORIS_SHORTCUT 178 ret PB_ERR_BAD_PREC 179 end 180 if eq get pb_st_u 4 0 181 ret PB_ERR_BAD_PTR 182 end 183 if lt get pb_st_i 0 0 184 ret PB_ERR_BAD_METRICS 185 end 186 if le get pb_st_i 1 0 187 ret PB_ERR_BAD_METRICS 188 end 189 if lt get pb_st_i 2 0 190 ret PB_ERR_BAD_METRICS 191 end 192 if lt get pb_st_i 3 0 193 ret PB_ERR_BAD_METRICS 194 end 195 if lt get pb_st_i 4 0 196 ret PB_ERR_BAD_METRICS 197 end 198 for i ulong PB_CAP 199 if eq get pb_used i 0 200 put pb_used i 1 201 put pb_sem i get pb_st_u 0 202 put pb_tid i get pb_st_u 1 203 put pb_prec i prec 204 put pb_proof i get pb_st_u 3 205 put pb_code_ptr i get pb_st_u 4 206 put pb_power_mw i get pb_st_i 0 207 put pb_lat_us i get pb_st_i 1 208 put pb_joules_uj i get pb_st_i 2 209 put pb_err_bound i get pb_st_i 3 210 wb = get pb_st_i 4 211 if eq wb 0 212 put pb_work_bits i `1000000` 213 else 214 put pb_work_bits i wb 215 end 216 put pb_count 0 add get pb_count 0 1 217 put pb_last_idx 0 i 218 ret PB_OK 219 end 220 end 221 ret PB_ERR_FULL 222 end 223 224 note Count realizations currently admitted for sem_id 225 fn pb_count_for_sem sem_id ulong to ulong 226 n = ulong 0 227 for i ulong PB_CAP 228 if eq get pb_used i 1 229 if eq get pb_sem i sem_id 230 n = add n 1 231 end 232 end 233 end 234 ret n 235 end 236 237 note True iff realization a strictly Pareto-dominates b on (power_mw, lat_us, err_bound) 238 fn pb_dominates a ulong b ulong to bool 239 if ge a PB_CAP 240 ret false 241 end 242 if ge b PB_CAP 243 ret false 244 end 245 if ne get pb_used a 1 246 ret false 247 end 248 if ne get pb_used b 1 249 ret false 250 end 251 if ne get pb_sem a get pb_sem b 252 ret false 253 end 254 if gt get pb_power_mw a get pb_power_mw b 255 ret false 256 end 257 if gt get pb_lat_us a get pb_lat_us b 258 ret false 259 end 260 if gt get pb_err_bound a get pb_err_bound b 261 ret false 262 end 263 if lt get pb_power_mw a get pb_power_mw b 264 ret true 265 end 266 if lt get pb_lat_us a get pb_lat_us b 267 ret true 268 end 269 if lt get pb_err_bound a get pb_err_bound b 270 ret true 271 end 272 ret false 273 end 274 275 note Count non-dominated Pareto-frontier realizations for sem_id 276 fn pb_frontier_count sem_id ulong to ulong 277 f = ulong 0 278 for i ulong PB_CAP 279 if eq get pb_used i 1 280 if eq get pb_sem i sem_id 281 dom = false 282 for j ulong PB_CAP 283 if ne j i 284 if pb_dominates j i 285 dom = true 286 break 287 end 288 end 289 end 290 if not dom 291 f = add f 1 292 end 293 end 294 end 295 end 296 ret f 297 end