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/gpu/forge/test.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 / gpu / forge / test.om` 610 lines ยท 18456 bytes Raw Blame History 1 note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 2 note gpu/forge/test.om: Comprehensive behavioral & negative-control test suite 3 note exercising hardware.om, envelope.om, provider.om, and realize.om. 4 note Compose as: si/directives/om2.om hardware.om envelope.om provider.om realize.om test.om 5 6 text fg_ts_pass "PASS " 7 text fg_ts_fail "FAIL " 8 text fg_ts_sum "FORGE_TEST_SUMMARY pass=" 9 text fg_ts_fsp " fail=" 10 11 text t_n01 "kat_v1_gb10_digest\n" 12 text t_n02 "hw_gb10_profile\n" 13 text t_n03 "hw_cpu_profiles\n" 14 text t_n04 "neg_hw_invalid_desc_refused\n" 15 text t_n05 "env_gb10_fp8_matmul_compute_bound\n" 16 text t_n06 "env_gb10_matvec_bw_bound\n" 17 text t_n07 "neg_oom_working_set_refused\n" 18 text t_n08 "neg_unsupported_dtype_refused\n" 19 text t_n09 "neg_unsupported_op_refused\n" 20 text t_n10 "neg_smem_exceeded_refused\n" 21 text t_n11 "neg_gpr_exceeded_refused\n" 22 text t_n12 "neg_over_sm_wave_refused_and_clamp\n" 23 text t_n13 "neg_thermal_ceiling_refused\n" 24 text t_n14 "neg_power_ceiling_refused\n" 25 text t_n15 "neg_latency_and_energy_budget_refused\n" 26 text t_n16 "prov_admit_gb10_qualified\n" 27 text t_n17 "neg_unqualified_gpu_blocked_hw\n" 28 text t_n18 "neg_not_run_optical_refused\n" 29 text t_n19 "neg_exercised_not_promoted_to_qualified\n" 30 text t_n20 "neg_analog_exact_and_stale_cal_refused\n" 31 text t_n21 "neg_analog_no_digital_fallback_refused\n" 32 text t_n22 "neg_faulted_and_queue_full_refused\n" 33 text t_n23 "realize_plan_determinism_and_aegis\n" 34 text t_n24 "neg_aegis_tampered_seal_refused\n" 35 36 fn fg_t_record ok bool label view uchar * stats edit uint 2 to void 37 if ok 38 fg_write_all 1 fg_ts_pass 39 fg_write_all 1 label 40 put stats 0 add get stats 0 1 41 else 42 fg_write_all 1 fg_ts_fail 43 fg_write_all 1 label 44 put stats 1 add get stats 1 1 45 end 46 ret 47 end 48 49 fn t01_kat to bool 50 ret fg_hw_v1_kat 51 end 52 53 fn t02_gb10_profile to bool 54 hid = new ForgeHwId 0 0 0 0 0 0 0 0 0 0 0 0 55 hcap = new ForgeHwCap 0 0 0 0 0.0f64 0.0f64 0 0 0 0.0f64 0 0 56 if not fg_hw_load_profile FG_HW_GB10_SM121 hid hcap 57 ret false 58 end 59 if ne fg_hw_validate hid hcap FG_HWVAL_OK 60 ret false 61 end 62 if not fg_hw_alias_is_sm121 hid 63 ret false 64 end 65 if ne get hid sm_count 48 66 ret false 67 end 68 if ne get hcap bw_gbps 273.0f64 69 ret false 70 end 71 if ne get hcap smem_cta 49152 72 ret false 73 end 74 want_dt = or or or or FG_DT_FP8 FG_DT_BF16 FG_DT_FP16 FG_DT_FP32 FG_DT_INT8 75 if ne and get hcap dtype_flags want_dt want_dt 76 ret false 77 end 78 ret true 79 end 80 81 fn t03_cpu_profiles to bool 82 hid = new ForgeHwId 0 0 0 0 0 0 0 0 0 0 0 0 83 hcap = new ForgeHwCap 0 0 0 0 0.0f64 0.0f64 0 0 0 0.0f64 0 0 84 if not fg_hw_load_profile FG_HW_AARCH64_GRACE hid hcap 85 ret false 86 end 87 if ne fg_hw_validate hid hcap FG_HWVAL_OK 88 ret false 89 end 90 if fg_hw_alias_is_sm121 hid 91 ret false 92 end 93 if ne get hid sm_count 20 94 ret false 95 end 96 if ne and get hcap dtype_flags FG_DT_FP8 0 97 ret false 98 end 99 if not fg_hw_load_profile FG_HW_GENERIC_CPU hid hcap 100 ret false 101 end 102 if ne fg_hw_validate hid hcap FG_HWVAL_OK 103 ret false 104 end 105 if ne get hid sm_count 8 106 ret false 107 end 108 ret true 109 end 110 111 fn t04_neg_invalid_hw to bool 112 hid = new ForgeHwId 0 0 0 0 0 0 0 0 0 0 0 0 113 hcap = new ForgeHwCap 0 0 0 0 0.0f64 0.0f64 0 0 0 0.0f64 0 0 114 fg_hw_load_gb10 hid hcap 115 put hcap mem_avail add get hcap mem_total 1 116 if ne fg_hw_validate hid hcap FG_HWVAL_BAD_MEMORY 117 ret false 118 end 119 fg_hw_load_gb10 hid hcap 120 put hid substrate_class FG_SUB_RESERVED_FIRST 121 if ne fg_hw_validate hid hcap FG_HWVAL_BAD_SUBSTRATE 122 ret false 123 end 124 fg_hw_load_gb10 hid hcap 125 put hid max_gpr uint 256 126 if ne fg_hw_validate hid hcap FG_HWVAL_BAD_GB10_ID 127 ret false 128 end 129 ret true 130 end 131 132 fn t05_env_fp8_matmul to bool 133 hid = new ForgeHwId 0 0 0 0 0 0 0 0 0 0 0 0 134 hcap = new ForgeHwCap 0 0 0 0 0.0f64 0.0f64 0 0 0 0.0f64 0 0 135 fg_hw_load_gb10 hid hcap 136 req = new ForgeContract 5 FG_OP_MATMUL FG_DT_FP8 4096 4096 4096 1 0 256 32768 64 0 FG_ERRK_EXACT 0 1 0 137 bud = new ForgeBudget 0.0f64 0.0f64 0.0f64 55000 1200 `1000000` 138 env = new ForgeEnvCheck 0 0 0 0 0 0 0 0 0.0f64 0.0f64 0.0f64 0.0f64 0.0f64 0.0f64 0 139 rc = fg_env_check hid hcap req bud env 140 if ne rc FG_ENV_OK 141 ret false 142 end 143 if ne get env ok 1 144 ret false 145 end 146 if ne get env compute_bound 1 147 ret false 148 end 149 if ne get env ws_bytes `50331648` 150 ret false 151 end 152 if ne get env eff_ctas 1024 153 ret false 154 end 155 if ne get env waves 22 156 ret false 157 end 158 if lt get env roof_us 550.0f64 159 ret false 160 end 161 if gt get env roof_us 560.0f64 162 ret false 163 end 164 ret true 165 end 166 167 fn t06_env_matvec_bw to bool 168 hid = new ForgeHwId 0 0 0 0 0 0 0 0 0 0 0 0 169 hcap = new ForgeHwCap 0 0 0 0 0.0f64 0.0f64 0 0 0 0.0f64 0 0 170 fg_hw_load_gb10 hid hcap 171 req = new ForgeContract 6 FG_OP_MATVEC FG_DT_FP32 4096 1 4096 1 0 256 4096 32 0 FG_ERRK_EXACT 0 1 0 172 bud = new ForgeBudget 0.0f64 0.0f64 0.0f64 45000 1200 `1000000` 173 env = new ForgeEnvCheck 0 0 0 0 0 0 0 0 0.0f64 0.0f64 0.0f64 0.0f64 0.0f64 0.0f64 0 174 rc = fg_env_check hid hcap req bud env 175 if ne rc FG_ENV_OK 176 ret false 177 end 178 if ne get env compute_bound 0 179 ret false 180 end 181 if le get env bw_us get env comp_us 182 ret false 183 end 184 ret true 185 end 186 187 fn t07_neg_oom to bool 188 hid = new ForgeHwId 0 0 0 0 0 0 0 0 0 0 0 0 189 hcap = new ForgeHwCap 0 0 0 0 0.0f64 0.0f64 0 0 0 0.0f64 0 0 190 fg_hw_load_gb10 hid hcap 191 req = new ForgeContract 7 FG_OP_MATMUL FG_DT_FP32 1024 1024 1024 1 0 256 0 32 `137438953472` FG_ERRK_EXACT 0 1 0 192 bud = new ForgeBudget 0.0f64 0.0f64 0.0f64 45000 1200 `1000000` 193 env = new ForgeEnvCheck 0 0 0 0 0 0 0 0 0.0f64 0.0f64 0.0f64 0.0f64 0.0f64 0.0f64 0 194 if ne fg_env_check hid hcap req bud env FG_ENV_ERR_OOM_WORKING_SET 195 ret false 196 end 197 put req extra_ws ulong 0 198 put req dim_m ulong `10000000000` 199 put req dim_n ulong `10000000000` 200 if ne fg_env_check hid hcap req bud env FG_ENV_ERR_OOM_WORKING_SET 201 ret false 202 end 203 ret true 204 end 205 206 fn t08_neg_dtype to bool 207 hid = new ForgeHwId 0 0 0 0 0 0 0 0 0 0 0 0 208 hcap = new ForgeHwCap 0 0 0 0 0.0f64 0.0f64 0 0 0 0.0f64 0 0 209 fg_hw_load_grace hid hcap 210 req = new ForgeContract 8 FG_OP_MATMUL FG_DT_FP8 512 512 512 1 0 1 0 16 0 FG_ERRK_EXACT 0 1 0 211 bud = new ForgeBudget 0.0f64 0.0f64 0.0f64 45000 1200 `1000000` 212 env = new ForgeEnvCheck 0 0 0 0 0 0 0 0 0.0f64 0.0f64 0.0f64 0.0f64 0.0f64 0.0f64 0 213 if ne fg_env_check hid hcap req bud env FG_ENV_ERR_UNSUPPORTED_DTYPE 214 ret false 215 end 216 fg_hw_load_generic_cpu hid hcap 217 put req dtype FG_DT_BF16 218 if ne fg_env_check hid hcap req bud env FG_ENV_ERR_UNSUPPORTED_DTYPE 219 ret false 220 end 221 ret true 222 end 223 224 fn t09_neg_op to bool 225 hid = new ForgeHwId 0 0 0 0 0 0 0 0 0 0 0 0 226 hcap = new ForgeHwCap 0 0 0 0 0.0f64 0.0f64 0 0 0 0.0f64 0 0 227 fg_hw_load_analog_sim hid hcap 228 req = new ForgeContract 9 FG_OP_MATMUL FG_DT_INT8 64 64 64 1 0 1 0 8 0 FG_ERRK_BOUNDED_DET 0 0 0 229 bud = new ForgeBudget 0.0f64 0.0f64 0.0f64 30000 1200 `1000000` 230 env = new ForgeEnvCheck 0 0 0 0 0 0 0 0 0.0f64 0.0f64 0.0f64 0.0f64 0.0f64 0.0f64 0 231 if ne fg_env_check hid hcap req bud env FG_ENV_ERR_UNSUPPORTED_OP 232 ret false 233 end 234 ret true 235 end 236 237 fn t10_neg_smem to bool 238 hid = new ForgeHwId 0 0 0 0 0 0 0 0 0 0 0 0 239 hcap = new ForgeHwCap 0 0 0 0 0.0f64 0.0f64 0 0 0 0.0f64 0 0 240 fg_hw_load_gb10 hid hcap 241 req = new ForgeContract 10 FG_OP_MATMUL FG_DT_FP16 1024 1024 1024 1 0 256 65536 32 0 FG_ERRK_EXACT 0 1 0 242 bud = new ForgeBudget 0.0f64 0.0f64 0.0f64 45000 1200 `1000000` 243 env = new ForgeEnvCheck 0 0 0 0 0 0 0 0 0.0f64 0.0f64 0.0f64 0.0f64 0.0f64 0.0f64 0 244 if ne fg_env_check hid hcap req bud env FG_ENV_ERR_SMEM_EXCEEDED 245 ret false 246 end 247 ret true 248 end 249 250 fn t11_neg_gpr to bool 251 hid = new ForgeHwId 0 0 0 0 0 0 0 0 0 0 0 0 252 hcap = new ForgeHwCap 0 0 0 0 0.0f64 0.0f64 0 0 0 0.0f64 0 0 253 fg_hw_load_gb10 hid hcap 254 req = new ForgeContract 11 FG_OP_MATMUL FG_DT_FP16 1024 1024 1024 1 0 256 16384 160 0 FG_ERRK_EXACT 0 1 0 255 bud = new ForgeBudget 0.0f64 0.0f64 0.0f64 45000 1200 `1000000` 256 env = new ForgeEnvCheck 0 0 0 0 0 0 0 0 0.0f64 0.0f64 0.0f64 0.0f64 0.0f64 0.0f64 0 257 if ne fg_env_check hid hcap req bud env FG_ENV_ERR_GPR_EXCEEDED 258 ret false 259 end 260 note SM register file overflow: 1024 threads * 96 GPRs = 98304 > 65536 261 put req thr_req uint 1024 262 put req gpr_req uint 96 263 if ne fg_env_check hid hcap req bud env FG_ENV_ERR_GPR_EXCEEDED 264 ret false 265 end 266 ret true 267 end 268 269 fn t12_neg_wave_cap to bool 270 hid = new ForgeHwId 0 0 0 0 0 0 0 0 0 0 0 0 271 hcap = new ForgeHwCap 0 0 0 0 0.0f64 0.0f64 0 0 0 0.0f64 0 0 272 fg_hw_load_gb10 hid hcap 273 req = new ForgeContract 12 FG_OP_MATMUL FG_DT_FP8 2048 2048 2048 1 96 256 16384 64 0 FG_ERRK_EXACT 0 1 1 274 bud = new ForgeBudget 0.0f64 0.0f64 0.0f64 45000 1200 `1000000` 275 env = new ForgeEnvCheck 0 0 0 0 0 0 0 0 0.0f64 0.0f64 0.0f64 0.0f64 0.0f64 0.0f64 0 276 if ne fg_env_check hid hcap req bud env FG_ENV_ERR_WAVE_SM_CAP 277 ret false 278 end 279 if ne fg_env_clamp_wave 96 48 48 280 ret false 281 end 282 put req cta_req uint 0 283 if ne fg_env_check hid hcap req bud env FG_ENV_OK 284 ret false 285 end 286 if ne get env eff_ctas 48 287 ret false 288 end 289 if ne get env waves 1 290 ret false 291 end 292 ret true 293 end 294 295 fn t13_neg_thermal to bool 296 hid = new ForgeHwId 0 0 0 0 0 0 0 0 0 0 0 0 297 hcap = new ForgeHwCap 0 0 0 0 0.0f64 0.0f64 0 0 0 0.0f64 0 0 298 fg_hw_load_gb10 hid hcap 299 req = new ForgeContract 13 FG_OP_MATMUL FG_DT_FP8 1024 1024 1024 1 48 256 16384 64 0 FG_ERRK_EXACT 0 1 0 300 bud = new ForgeBudget 0.0f64 0.0f64 0.0f64 92000 1200 `1000000` 301 env = new ForgeEnvCheck 0 0 0 0 0 0 0 0 0.0f64 0.0f64 0.0f64 0.0f64 0.0f64 0.0f64 0 302 if ne fg_env_check hid hcap req bud env FG_ENV_ERR_THERMAL_CEILING 303 ret false 304 end 305 ret true 306 end 307 308 fn t14_neg_power to bool 309 hid = new ForgeHwId 0 0 0 0 0 0 0 0 0 0 0 0 310 hcap = new ForgeHwCap 0 0 0 0 0.0f64 0.0f64 0 0 0 0.0f64 0 0 311 fg_hw_load_gb10 hid hcap 312 req = new ForgeContract 14 FG_OP_MATMUL FG_DT_FP8 2048 2048 2048 1 48 256 16384 64 0 FG_ERRK_EXACT 0 1 0 313 bud = new ForgeBudget 0.0f64 0.0f64 20.0f64 45000 1200 `1000000` 314 env = new ForgeEnvCheck 0 0 0 0 0 0 0 0 0.0f64 0.0f64 0.0f64 0.0f64 0.0f64 0.0f64 0 315 if ne fg_env_check hid hcap req bud env FG_ENV_ERR_POWER_CEILING 316 ret false 317 end 318 ret true 319 end 320 321 fn t15_neg_lat_eng to bool 322 hid = new ForgeHwId 0 0 0 0 0 0 0 0 0 0 0 0 323 hcap = new ForgeHwCap 0 0 0 0 0.0f64 0.0f64 0 0 0 0.0f64 0 0 324 fg_hw_load_gb10 hid hcap 325 req = new ForgeContract 15 FG_OP_MATMUL FG_DT_FP8 4096 4096 4096 1 0 256 16384 64 0 FG_ERRK_EXACT 0 1 0 326 bud = new ForgeBudget 0.01f64 0.0f64 0.0f64 45000 1200 `1000000` 327 env = new ForgeEnvCheck 0 0 0 0 0 0 0 0 0.0f64 0.0f64 0.0f64 0.0f64 0.0f64 0.0f64 0 328 if ne fg_env_check hid hcap req bud env FG_ENV_ERR_LATENCY_BUDGET 329 ret false 330 end 331 put bud lat_us 0.0f64 332 put bud energy_mj 0.001f64 333 if ne fg_env_check hid hcap req bud env FG_ENV_ERR_ENERGY_BUDGET 334 ret false 335 end 336 ret true 337 end 338 339 fn t16_prov_gb10_qualified to bool 340 fg_reg_load_defaults 341 req = new ForgeContract 16 FG_OP_MATMUL FG_DT_FP8 4096 4096 4096 1 0 256 16384 64 0 FG_ERRK_EXACT 0 1 0 342 bud = new ForgeBudget 0.0f64 0.0f64 0.0f64 50000 1200 `1000000` 343 adm = new ForgeAdmit 0 0 0 0 0 0 0 344 env = new ForgeEnvCheck 0 0 0 0 0 0 0 0 0.0f64 0.0f64 0.0f64 0.0f64 0.0f64 0.0f64 0 345 rc = fg_prov_admit req bud adm env 346 if ne rc FG_ADMIT_OK 347 ret false 348 end 349 if ne get adm admitted 1 350 ret false 351 end 352 if ne get adm prov_id 1 353 ret false 354 end 355 if ne get adm hw_id FG_HW_GB10_SM121 356 ret false 357 end 358 ret true 359 end 360 361 fn t17_neg_unqual_gpu to bool 362 fg_reg_clear 363 p = new ForgeProvider 2 FG_HW_AARCH64_GRACE FG_SUB_DIGITAL_CPU FG_QUAL_QUALIFIED FG_ERRK_EXACT 0 0 0 0 0 FG_FAULT_NONE 0 FG_LOW_COMPILED 364 ok = fg_reg_add p 365 put p prov_id uint 5 366 put p hw_id FG_HW_UNQUAL_GPU 367 put p substrate_class FG_SUB_DIGITAL_GPU 368 put p qual_status FG_QUAL_BLOCKED_HW 369 put p lowering_kind FG_LOW_NONE 370 ok = and ok fg_reg_add p 371 if not ok 372 ret false 373 end 374 req = new ForgeContract 17 FG_OP_MATMUL FG_DT_FP16 1024 1024 1024 1 0 256 16384 32 0 FG_ERRK_EXACT FG_SUB_DIGITAL_GPU 1 0 375 bud = new ForgeBudget 0.0f64 0.0f64 0.0f64 45000 1200 `1000000` 376 adm = new ForgeAdmit 0 0 0 0 0 0 0 377 env = new ForgeEnvCheck 0 0 0 0 0 0 0 0 0.0f64 0.0f64 0.0f64 0.0f64 0.0f64 0.0f64 0 378 rc = fg_prov_admit req bud adm env 379 if ne rc FG_ADMIT_BLOCKED_HARDWARE 380 ret false 381 end 382 if ne get adm admitted 0 383 ret false 384 end 385 ret true 386 end 387 388 fn t18_neg_not_run_optical to bool 389 fg_reg_load_defaults 390 req = new ForgeContract 18 FG_OP_MATVEC FG_DT_INT8 64 1 64 1 0 1 0 8 0 FG_ERRK_BOUNDED_STOCH FG_SUB_OPTICAL_PHOTONIC 0 0 391 bud = new ForgeBudget 0.0f64 0.0f64 0.0f64 30000 1200 `1000000` 392 adm = new ForgeAdmit 0 0 0 0 0 0 0 393 env = new ForgeEnvCheck 0 0 0 0 0 0 0 0 0.0f64 0.0f64 0.0f64 0.0f64 0.0f64 0.0f64 0 394 rc = fg_prov_admit req bud adm env 395 if ne rc FG_ADMIT_NOT_RUN 396 ret false 397 end 398 if ne get adm admitted 0 399 ret false 400 end 401 ret true 402 end 403 404 fn t19_neg_exercised_not_qual to bool 405 fg_reg_clear 406 p = new ForgeProvider 3 FG_HW_GENERIC_CPU FG_SUB_DIGITAL_CPU FG_QUAL_EXERCISED FG_ERRK_EXACT 0 0 0 0 0 FG_FAULT_NONE 0 FG_LOW_COMPILED 407 if not fg_reg_add p 408 ret false 409 end 410 req = new ForgeContract 19 FG_OP_MATMUL FG_DT_FP32 256 256 256 1 0 1 0 16 0 FG_ERRK_EXACT FG_SUB_DIGITAL_CPU 1 0 411 bud = new ForgeBudget 0.0f64 0.0f64 0.0f64 45000 1200 `1000000` 412 adm = new ForgeAdmit 0 0 0 0 0 0 0 413 env = new ForgeEnvCheck 0 0 0 0 0 0 0 0 0.0f64 0.0f64 0.0f64 0.0f64 0.0f64 0.0f64 0 414 rc = fg_prov_admit req bud adm env 415 if ne rc FG_ADMIT_BLOCKED_HARDWARE 416 ret false 417 end 418 if ne get adm admitted 0 419 ret false 420 end 421 ret true 422 end 423 424 fn t20_neg_analog_cal_and_errk to bool 425 fg_reg_load_defaults 426 req = new ForgeContract 20 FG_OP_MATVEC FG_DT_INT8 64 1 64 1 0 1 0 8 0 FG_ERRK_EXACT FG_SUB_ANALOG_IN_MEMORY 0 0 427 bud = new ForgeBudget 0.0f64 0.0f64 0.0f64 30000 2000 `1000000` 428 adm = new ForgeAdmit 0 0 0 0 0 0 0 429 env = new ForgeEnvCheck 0 0 0 0 0 0 0 0 0.0f64 0.0f64 0.0f64 0.0f64 0.0f64 0.0f64 0 430 note Analog (BOUNDED_DET) must refuse EXACT contract 431 if ne fg_prov_admit req bud adm env FG_ADMIT_ERROR_KIND 432 ret false 433 end 434 note Stale calibration window (epoch 1000 + window 3600 = 4600; now = 9000) 435 put req error_kind FG_ERRK_BOUNDED_DET 436 put bud now_epoch_s ulong 9000 437 if ne fg_prov_admit req bud adm env FG_ADMIT_CAL_STALE 438 ret false 439 end 440 note Out-of-envelope temperature (68000 > cal_tmax 65000) 441 put bud now_epoch_s ulong 2000 442 put bud temp_mc int 68000 443 if ne fg_prov_admit req bud adm env FG_ADMIT_CAL_ENVELOPE 444 ret false 445 end 446 note Fresh calibration inside envelope with digital fallback present -> ADMITTED 447 put bud temp_mc int 30000 448 if ne fg_prov_admit req bud adm env FG_ADMIT_OK 449 ret false 450 end 451 if ne get adm prov_id 4 452 ret false 453 end 454 if ne get adm has_dig_fb 1 455 ret false 456 end 457 ret true 458 end 459 460 fn t21_neg_no_digital_fallback to bool 461 fg_reg_clear 462 p = new ForgeProvider 4 FG_HW_ANALOG_SIM FG_SUB_ANALOG_IN_MEMORY FG_QUAL_SIMULATED FG_ERRK_BOUNDED_DET 1 1000 3600 15000 65000 FG_FAULT_NONE 0 FG_LOW_SIMULATED 463 if not fg_reg_add p 464 ret false 465 end 466 req = new ForgeContract 21 FG_OP_MATVEC FG_DT_INT8 64 1 64 1 0 1 0 8 0 FG_ERRK_BOUNDED_DET FG_SUB_ANALOG_IN_MEMORY 0 0 467 bud = new ForgeBudget 0.0f64 0.0f64 0.0f64 30000 2000 `1000000` 468 adm = new ForgeAdmit 0 0 0 0 0 0 0 469 env = new ForgeEnvCheck 0 0 0 0 0 0 0 0 0.0f64 0.0f64 0.0f64 0.0f64 0.0f64 0.0f64 0 470 rc = fg_prov_admit req bud adm env 471 if ne rc FG_ADMIT_NO_DIGITAL_FB 472 ret false 473 end 474 if ne get adm admitted 0 475 ret false 476 end 477 ret true 478 end 479 480 fn t22_neg_fault_and_queue to bool 481 fg_reg_clear 482 p = new ForgeProvider 1 FG_HW_GB10_SM121 FG_SUB_DIGITAL_GPU FG_QUAL_QUALIFIED FG_ERRK_EXACT 0 0 0 0 0 FG_FAULT_PERSISTENT 0 FG_LOW_COMPILED 483 if not fg_reg_add p 484 ret false 485 end 486 req = new ForgeContract 22 FG_OP_MATMUL FG_DT_FP8 1024 1024 1024 1 0 256 16384 64 0 FG_ERRK_EXACT FG_SUB_DIGITAL_GPU 1 0 487 bud = new ForgeBudget 0.0f64 0.0f64 0.0f64 45000 1200 `1000000` 488 adm = new ForgeAdmit 0 0 0 0 0 0 0 489 env = new ForgeEnvCheck 0 0 0 0 0 0 0 0 0.0f64 0.0f64 0.0f64 0.0f64 0.0f64 0.0f64 0 490 if ne fg_prov_admit req bud adm env FG_ADMIT_FAULTED 491 ret false 492 end 493 if not fg_reg_set_fault 0 FG_FAULT_NONE 494 ret false 495 end 496 if not fg_reg_set_queues 0 4 497 ret false 498 end 499 if ne fg_prov_admit req bud adm env FG_ADMIT_QUEUE_FULL 500 ret false 501 end 502 ret true 503 end 504 505 fn t23_realize_determinism to bool 506 fg_reg_load_defaults 507 req = new ForgeContract 23 FG_OP_MATMUL FG_DT_BF16 2048 2048 2048 1 0 256 32768 64 0 FG_ERRK_EXACT FG_SUB_DIGITAL_GPU 1 0 508 bud = new ForgeBudget 0.0f64 0.0f64 0.0f64 50000 1200 `1000000` 509 p1 = new ForgePlan 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 510 e1 = new ForgeEnvCheck 0 0 0 0 0 0 0 0 0.0f64 0.0f64 0.0f64 0.0f64 0.0f64 0.0f64 0 511 s1 = new ForgeSeals 0 0 0 0 512 p2 = new ForgePlan 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 513 e2 = new ForgeEnvCheck 0 0 0 0 0 0 0 0 0.0f64 0.0f64 0.0f64 0.0f64 0.0f64 0.0f64 0 514 s2 = new ForgeSeals 0 0 0 0 515 if ne fg_realize_plan req bud p1 e1 s1 FG_ADMIT_OK 516 ret false 517 end 518 if ne fg_realize_plan req bud p2 e2 s2 FG_ADMIT_OK 519 ret false 520 end 521 if not fg_aegis_verify_seal p1 s1 522 ret false 523 end 524 d1 = new uchar 32 0 525 d2 = new uchar 32 0 526 fg_seals_get_plan s1 d1 527 fg_seals_get_plan s2 d2 528 if not fg_bytes_eq d1 d2 32 529 ret false 530 end 531 fg_seals_get_tok s1 d1 532 fg_seals_get_tok s2 d2 533 if not fg_bytes_eq d1 d2 32 534 ret false 535 end 536 ret true 537 end 538 539 fn t24_neg_aegis_tamper to bool 540 fg_reg_load_defaults 541 req = new ForgeContract 24 FG_OP_MATMUL FG_DT_FP8 1024 1024 1024 1 0 256 16384 64 0 FG_ERRK_EXACT FG_SUB_DIGITAL_GPU 1 0 542 bud = new ForgeBudget 0.0f64 0.0f64 0.0f64 50000 1200 `1000000` 543 pl = new ForgePlan 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 544 env = new ForgeEnvCheck 0 0 0 0 0 0 0 0 0.0f64 0.0f64 0.0f64 0.0f64 0.0f64 0.0f64 0 545 sl = new ForgeSeals 0 0 0 0 546 if ne fg_realize_plan req bud pl env sl FG_ADMIT_OK 547 ret false 548 end 549 if not fg_aegis_verify_seal pl sl 550 ret false 551 end 552 note Tamper lowering_kind (relabel attack per DRA-176) 553 put pl lowering_kind FG_LOW_SIMULATED 554 if fg_aegis_verify_seal pl sl 555 ret false 556 end 557 put pl lowering_kind FG_LOW_COMPILED 558 note Tamper 1 bit of sealed plan_id 559 put sl plan_id 0 xor get sl plan_id 0 ulong 1 560 if fg_aegis_verify_seal pl sl 561 ret false 562 end 563 note Refused plan must never verify under AEGIS 564 put bud temp_mc int 95000 565 rc = fg_realize_plan req bud pl env sl 566 if eq rc FG_ADMIT_OK 567 ret false 568 end 569 if fg_aegis_verify_seal pl sl 570 ret false 571 end 572 ret true 573 end 574 575 fn main to int 576 st = new uint 2 0 577 fg_t_record t01_kat t_n01 st 578 fg_t_record t02_gb10_profile t_n02 st 579 fg_t_record t03_cpu_profiles t_n03 st 580 fg_t_record t04_neg_invalid_hw t_n04 st 581 fg_t_record t05_env_fp8_matmul t_n05 st 582 fg_t_record t06_env_matvec_bw t_n06 st 583 fg_t_record t07_neg_oom t_n07 st 584 fg_t_record t08_neg_dtype t_n08 st 585 fg_t_record t09_neg_op t_n09 st 586 fg_t_record t10_neg_smem t_n10 st 587 fg_t_record t11_neg_gpr t_n11 st 588 fg_t_record t12_neg_wave_cap t_n12 st 589 fg_t_record t13_neg_thermal t_n13 st 590 fg_t_record t14_neg_power t_n14 st 591 fg_t_record t15_neg_lat_eng t_n15 st 592 fg_t_record t16_prov_gb10_qualified t_n16 st 593 fg_t_record t17_neg_unqual_gpu t_n17 st 594 fg_t_record t18_neg_not_run_optical t_n18 st 595 fg_t_record t19_neg_exercised_not_qual t_n19 st 596 fg_t_record t20_neg_analog_cal_and_errk t_n20 st 597 fg_t_record t21_neg_no_digital_fallback t_n21 st 598 fg_t_record t22_neg_fault_and_queue t_n22 st 599 fg_t_record t23_realize_determinism t_n23 st 600 fg_t_record t24_neg_aegis_tamper t_n24 st 601 fg_write_all 1 fg_ts_sum 602 fg_write_u64 1 ulong get st 0 603 fg_write_all 1 fg_ts_fsp 604 fg_write_u64 1 ulong get st 1 605 fg_write_all 1 fg_t_nl 606 if ne get st 1 0 607 ret int 1 608 end 609 ret int 0 610 end