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
omega-mv / tests / dagsim / dagsim_unit.om
| 1 | note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 2 | note tests/dagsim/dagsim_unit.om -- Pure seeded OM-2 analytical unit tests for dagsim (omega-mv#583). |
| 3 | note Composed after tools/dagsim/dagsim.om: |
| 4 | note cat tools/dagsim/dagsim.om tests/dagsim/dagsim_unit.om | seed/out/omc > dagsim_unit |
| 5 | |
| 6 | global u_checks ulong 1 |
| 7 | global u_fail ulong 1 |
| 8 | global u_sc2 ulong 8192 |
| 9 | global u_rsn2 uchar 256 |
| 10 | global u_rsn2_len ulong 1 |
| 11 | |
| 12 | text u_hdr "oev version=1\nmachine id=t soc=t cores=4 mem_bytes=1000 prov=specified src=test\nbuild repo=omega-mv sha=0000000000000000000000000000000000000000\ncalibration id=c1 taken=2026-10-19 valid_days=30 load1=1.0 src=test\nresource id=mem kind=capacity cap=1000 prov=specified src=test\nenergy instrument=none\n" |
| 13 | text u_d20 "2026-10-20" |
| 14 | text u_d24 "2026-10-24" |
| 15 | text u_dnov18 "2026-11-18" |
| 16 | text u_dnov19 "2026-11-19" |
| 17 | text u_fail_pfx " FAIL " |
| 18 | text u_sum1 "dagsim_unit: " |
| 19 | text u_sum2 " checks, " |
| 20 | text u_sum3 " failed\n" |
| 21 | |
| 22 | fn u_check cond bool msg view uchar * to void |
| 23 | put u_checks 0 add get u_checks 0 1 |
| 24 | if not cond |
| 25 | put u_fail 0 add get u_fail 0 1 |
| 26 | ds_out_reset |
| 27 | ds_out_text u_fail_pfx |
| 28 | ds_out_text msg |
| 29 | ds_out_ch uchar 10 |
| 30 | ds_out_flush 2 |
| 31 | end |
| 32 | end |
| 33 | |
| 34 | fn u_near a f64 b f64 tol f64 to bool |
| 35 | ret le fabs sub a b tol |
| 36 | end |
| 37 | |
| 38 | fn u_day s view uchar * to long |
| 39 | ret ds_day_from_slice s len s |
| 40 | end |
| 41 | |
| 42 | fn u_set_txt1 side ulong h view uchar * to void |
| 43 | nh = len h |
| 44 | if eq side 0 |
| 45 | for i ulong nh bound 8192 |
| 46 | put ds_txt i get h i |
| 47 | end |
| 48 | put ds_txt_len 0 nh |
| 49 | else |
| 50 | for i ulong nh bound 8192 |
| 51 | put ds_txt2 i get h i |
| 52 | end |
| 53 | put ds_txt2_len 0 nh |
| 54 | end |
| 55 | end |
| 56 | |
| 57 | fn u_set_txt side ulong h view uchar * b view uchar * to void |
| 58 | nh = len h |
| 59 | nb = len b |
| 60 | if eq side 0 |
| 61 | for i ulong nh bound 1024 |
| 62 | put ds_txt i get h i |
| 63 | end |
| 64 | for i ulong nb bound 8192 |
| 65 | put ds_txt add nh i get b i |
| 66 | end |
| 67 | put ds_txt_len 0 add nh nb |
| 68 | else |
| 69 | for i ulong nh bound 1024 |
| 70 | put ds_txt2 i get h i |
| 71 | end |
| 72 | for i ulong nb bound 8192 |
| 73 | put ds_txt2 add nh i get b i |
| 74 | end |
| 75 | put ds_txt2_len 0 add nh nb |
| 76 | end |
| 77 | end |
| 78 | |
| 79 | fn u_rsn_has sub_s view uchar * to bool |
| 80 | ns = len sub_s |
| 81 | nr = get ds_reason_len 0 |
| 82 | if gt ns nr |
| 83 | ret false |
| 84 | end |
| 85 | lim = add sub nr ns 1 |
| 86 | for i ulong lim bound 256 |
| 87 | ok = true |
| 88 | for j ulong ns bound 128 |
| 89 | if ne get ds_reason add i j get sub_s j |
| 90 | ok = false |
| 91 | break |
| 92 | end |
| 93 | end |
| 94 | if ok |
| 95 | ret true |
| 96 | end |
| 97 | end |
| 98 | ret false |
| 99 | end |
| 100 | |
| 101 | fn u_err_has sub_s view uchar * to bool |
| 102 | ns = len sub_s |
| 103 | nr = ulong 0 |
| 104 | while lt nr 255 bound 256 |
| 105 | if eq get ds_err nr 0 |
| 106 | break |
| 107 | end |
| 108 | nr = add nr 1 |
| 109 | end |
| 110 | if gt ns nr |
| 111 | ret false |
| 112 | end |
| 113 | lim = add sub nr ns 1 |
| 114 | for i ulong lim bound 256 |
| 115 | ok = true |
| 116 | for j ulong ns bound 128 |
| 117 | if ne get ds_err add i j get sub_s j |
| 118 | ok = false |
| 119 | break |
| 120 | end |
| 121 | end |
| 122 | if ok |
| 123 | ret true |
| 124 | end |
| 125 | end |
| 126 | ret false |
| 127 | end |
| 128 | |
| 129 | text u_inv_bnd "makespan below bound" |
| 130 | text u_inv_cp "below critical path bound" |
| 131 | text u_inv_attr "attribution does not sum to makespan" |
| 132 | text u_inv_det "not deterministic" |
| 133 | |
| 134 | fn u_check_invariants asof long hasm ulong to void |
| 135 | mk = bitcast f64 get ds_sc 3 |
| 136 | bnd = bitcast f64 get ds_sc 19 |
| 137 | cpb = bitcast f64 get ds_sc 20 |
| 138 | u_check ge add mk 0.000001f64 bnd u_inv_bnd |
| 139 | u_check ge add mk 0.000001f64 cpb u_inv_cp |
| 140 | s = f64 0.0f64 |
| 141 | for i ulong 7 |
| 142 | s = add s bitcast f64 get ds_sc add 5824 i |
| 143 | end |
| 144 | u_check u_near s mk 0.000001f64 u_inv_attr |
| 145 | for i ulong 8192 |
| 146 | put u_sc2 i get ds_sc i |
| 147 | end |
| 148 | rc2 = ds_eval_current 0 asof hasm bitcast ulong 0.9f64 |
| 149 | same = eq rc2 0 |
| 150 | if same |
| 151 | for i ulong 8192 |
| 152 | if ne get u_sc2 i get ds_sc i |
| 153 | same = false |
| 154 | break |
| 155 | end |
| 156 | end |
| 157 | end |
| 158 | u_check same u_inv_det |
| 159 | end |
| 160 | |
| 161 | fn u_eval_body body view uchar * asof long hasm ulong to ulong |
| 162 | u_set_txt 0 u_hdr body |
| 163 | if ne ds_parse_side 0 0 |
| 164 | ret 9 |
| 165 | end |
| 166 | rc = ds_eval_current 0 asof hasm bitcast ulong 0.9f64 |
| 167 | if eq rc 0 |
| 168 | u_check_invariants asof hasm |
| 169 | end |
| 170 | ret rc |
| 171 | end |
| 172 | |
| 173 | fn u_eval_file path view uchar * asof long to ulong |
| 174 | if ne ds_read_file_side 0 path len path 0 |
| 175 | ret 9 |
| 176 | end |
| 177 | ret ds_eval_current 0 asof 0 bitcast ulong 0.9f64 |
| 178 | end |
| 179 | |
| 180 | note ---- 1. test_serial_chain ---- |
| 181 | text t1_body "resource id=cpu kind=compute slots=1 prov=specified src=test\nop id=A kind=compute engine=cpu t_ns=10 prov=measured src=t\nop id=B kind=compute engine=cpu t_ns=20 prov=measured src=t\nop id=C kind=compute engine=cpu t_ns=30 prov=measured src=t\ndep A B\ndep B C\n" |
| 182 | text t1_m1 "serial chain status" |
| 183 | text t1_m2 "serial makespan" |
| 184 | text t1_m3 "critical path bound" |
| 185 | text t1_m4 "critical path length" |
| 186 | text t1_m5 "compute attribution" |
| 187 | text t1_m6 "residual" |
| 188 | text t1_m7 "C window" |
| 189 | text t1_m8 "prov mask" |
| 190 | text t1_m9 "conservation" |
| 191 | |
| 192 | fn test_serial_chain to void |
| 193 | rc = u_eval_body t1_body u_day u_d20 0 |
| 194 | u_check eq rc 0 t1_m1 |
| 195 | u_check u_near bitcast f64 get ds_sc 3 60.0f64 1.0e-9f64 t1_m2 |
| 196 | u_check u_near bitcast f64 get ds_sc 20 60.0f64 1.0e-9f64 t1_m3 |
| 197 | u_check eq get ds_sc 21 3 t1_m4 |
| 198 | u_check u_near bitcast f64 get ds_sc 5824 60.0f64 1.0e-9f64 t1_m5 |
| 199 | u_check u_near bitcast f64 get ds_sc 5830 0.0f64 1.0e-9f64 t1_m6 |
| 200 | u_check and u_near bitcast f64 get ds_sc 4514 30.0f64 1.0e-9f64 u_near bitcast f64 get ds_sc 4770 60.0f64 1.0e-9f64 t1_m7 |
| 201 | u_check eq get ds_sc 11 24 t1_m8 |
| 202 | u_check and eq get ds_pm 12 3 u_near bitcast f64 get ds_sc 16 60.0f64 1.0e-9f64 t1_m9 |
| 203 | end |
| 204 | |
| 205 | note ---- 2. test_perfect_overlap ---- |
| 206 | text t2_b1 "resource id=cpu kind=compute slots=4 prov=specified src=test\nop id=A kind=compute engine=cpu t_ns=10 prov=measured src=t\nop id=B kind=compute engine=cpu t_ns=20 prov=measured src=t\nop id=C kind=compute engine=cpu t_ns=30 prov=measured src=t\n" |
| 207 | text t2_b2 "resource id=cpu kind=compute slots=1 prov=specified src=test\nop id=A kind=compute engine=cpu t_ns=10 prov=measured src=t\nop id=B kind=compute engine=cpu t_ns=20 prov=measured src=t\nop id=C kind=compute engine=cpu t_ns=30 prov=measured src=t\n" |
| 208 | text t2_m1 "overlap status" |
| 209 | text t2_m2 "independent overlap makespan" |
| 210 | text t2_m3 "no serialization when slots suffice" |
| 211 | text t2_m4 "one slot status" |
| 212 | text t2_m5 "one-slot makespan" |
| 213 | text t2_m6 "critical path stays 30" |
| 214 | text t2_m7 "resource bound 60" |
| 215 | text t2_m8 "serialization 30" |
| 216 | |
| 217 | fn test_perfect_overlap to void |
| 218 | d = u_day u_d20 |
| 219 | rc = u_eval_body t2_b1 d 0 |
| 220 | u_check eq rc 0 t2_m1 |
| 221 | u_check u_near bitcast f64 get ds_sc 3 30.0f64 1.0e-9f64 t2_m2 |
| 222 | u_check u_near bitcast f64 get ds_sc 5828 0.0f64 1.0e-9f64 t2_m3 |
| 223 | rc = u_eval_body t2_b2 d 0 |
| 224 | u_check eq rc 0 t2_m4 |
| 225 | u_check u_near bitcast f64 get ds_sc 3 60.0f64 1.0e-9f64 t2_m5 |
| 226 | u_check u_near bitcast f64 get ds_sc 20 30.0f64 1.0e-9f64 t2_m6 |
| 227 | u_check u_near bitcast f64 get ds_sc 19 60.0f64 1.0e-9f64 t2_m7 |
| 228 | u_check u_near bitcast f64 get ds_sc 5828 30.0f64 1.0e-9f64 t2_m8 |
| 229 | end |
| 230 | |
| 231 | note ---- 3. test_shared_bandwidth ---- |
| 232 | text t3_b1 "resource id=cpu kind=compute slots=2 prov=specified src=test\nresource id=pipe kind=bandwidth cap=1e9 prov=measured src=t\nop id=A kind=copy engine=cpu bytes=1e9 bw=pipe prov=measured src=t\nop id=B kind=copy engine=cpu bytes=1e9 bw=pipe prov=measured src=t\n" |
| 233 | text t3_b2 "resource id=cpu kind=compute slots=2 prov=specified src=test\nresource id=pipe kind=bandwidth cap=1e9 prov=measured src=t\nop id=A kind=copy engine=cpu bytes=1e9 bw=pipe prov=measured src=t\nop id=B kind=copy engine=cpu bytes=5e8 bw=pipe prov=measured src=t\n" |
| 234 | text t3_b3 "resource id=cpu kind=compute slots=1 prov=specified src=test\nresource id=pipe kind=bandwidth cap=1e9 prov=measured src=t\nop id=A kind=compute engine=cpu t_ns=5e8 bytes=1e9 bw=pipe prov=measured src=t\n" |
| 235 | text t3_b4 "resource id=cpu kind=compute slots=1 prov=specified src=test\nresource id=pipe kind=bandwidth cap=1e9 prov=measured src=t\nop id=A kind=compute engine=cpu t_ns=4e9 bytes=1e9 bw=pipe prov=measured src=t\n" |
| 236 | text t3_b5 "resource id=cpu kind=compute slots=1 prov=specified src=test\nresource id=pipe kind=bandwidth cap=1e9 prov=measured src=t\nop id=A kind=copy engine=cpu bytes=1e9 bw=pipe prov=measured src=t\nop id=B kind=copy engine=cpu bytes=1e9 bw=pipe prov=measured src=t\n" |
| 237 | text t3_m1 "bw status" |
| 238 | text t3_m2 "two concurrent copies 2e9" |
| 239 | text t3_m3 "both end at 2 s" |
| 240 | text t3_m4 "A contention 1e9" |
| 241 | text t3_m5 "cp bound 1 s" |
| 242 | text t3_m6 "pipe work bound 2 s" |
| 243 | text t3_m7 "bw+contention = 2 s" |
| 244 | text t3_m8 "contention attributed 1 s" |
| 245 | text t3_m9 "bw2 status" |
| 246 | text t3_m10 "B ends at 1 s" |
| 247 | text t3_m11 "A ends at 1.5 s" |
| 248 | text t3_m12 "max(F/P,Q/B) floor" |
| 249 | text t3_m13 "op floor" |
| 250 | text t3_m14 "compute-bound op alone" |
| 251 | text t3_m15 "attributed as compute" |
| 252 | text t3_m16 "serialized copies no contention" |
| 253 | |
| 254 | fn test_shared_bandwidth to void |
| 255 | d = u_day u_d20 |
| 256 | rc = u_eval_body t3_b1 d 0 |
| 257 | u_check eq rc 0 t3_m1 |
| 258 | u_check u_near bitcast f64 get ds_sc 3 2.0e9f64 1.0e-3f64 t3_m2 |
| 259 | u_check and u_near bitcast f64 get ds_sc 4768 2.0e9f64 1.0e-3f64 u_near bitcast f64 get ds_sc 4769 2.0e9f64 1.0e-3f64 t3_m3 |
| 260 | u_check u_near bitcast f64 get ds_sc 5536 1.0e9f64 1.0e-3f64 t3_m4 |
| 261 | u_check u_near bitcast f64 get ds_sc 20 1.0e9f64 1.0e-3f64 t3_m5 |
| 262 | u_check u_near bitcast f64 get ds_sc 19 2.0e9f64 1.0e-3f64 t3_m6 |
| 263 | u_check u_near add bitcast f64 get ds_sc 5825 bitcast f64 get ds_sc 5826 2.0e9f64 1.0e-3f64 t3_m7 |
| 264 | u_check u_near bitcast f64 get ds_sc 5826 1.0e9f64 1.0e-3f64 t3_m8 |
| 265 | rc = u_eval_body t3_b2 d 0 |
| 266 | u_check eq rc 0 t3_m9 |
| 267 | u_check u_near bitcast f64 get ds_sc 4769 1.0e9f64 1.0e-3f64 t3_m10 |
| 268 | u_check u_near bitcast f64 get ds_sc 4768 1.5e9f64 1.0e-3f64 t3_m11 |
| 269 | rc = u_eval_body t3_b3 d 0 |
| 270 | u_check and eq rc 0 u_near bitcast f64 get ds_sc 3 1.0e9f64 1.0e-3f64 t3_m12 |
| 271 | u_check u_near bitcast f64 get ds_sc 5280 1.0e9f64 1.0e-3f64 t3_m13 |
| 272 | rc = u_eval_body t3_b4 d 0 |
| 273 | u_check and eq rc 0 and u_near bitcast f64 get ds_sc 3 4.0e9f64 1.0e-3f64 u_near bitcast f64 get ds_sc 5536 0.0f64 1.0e-3f64 t3_m14 |
| 274 | u_check u_near bitcast f64 get ds_sc 5824 4.0e9f64 1.0e-3f64 t3_m15 |
| 275 | rc = u_eval_body t3_b5 d 0 |
| 276 | u_check and eq rc 0 and u_near bitcast f64 get ds_sc 3 2.0e9f64 1.0e-3f64 u_near bitcast f64 get ds_sc 5826 0.0f64 1.0e-3f64 t3_m16 |
| 277 | end |
| 278 | |
| 279 | note ---- 4. test_capacity_refusal ---- |
| 280 | text t4_b1 "resource id=cpu kind=compute slots=2 prov=specified src=test\nop id=A kind=compute engine=cpu t_ns=10 prov=measured src=t\nbuffer id=x bytes=600 cap=mem first=A last=A\nbuffer id=y bytes=600 cap=mem first=A last=A\n" |
| 281 | text t4_b2 "resource id=cpu kind=compute slots=2 prov=specified src=test\nop id=A kind=compute engine=cpu t_ns=10 prov=measured src=t\nop id=B kind=compute engine=cpu t_ns=10 prov=measured src=t\ndep A B\nbuffer id=x bytes=600 cap=mem first=A last=A\nbuffer id=y bytes=600 cap=mem first=B last=B\n" |
| 282 | text t4_b3 "resource id=cpu kind=compute slots=2 prov=specified src=test\nop id=A kind=compute engine=cpu t_ns=10 prov=measured src=t\nbuffer id=big bytes=2000 cap=mem\n" |
| 283 | text t4_sx "x" |
| 284 | text t4_sy "y" |
| 285 | text t4_m1 "1200 live bytes in 1000 refuses" |
| 286 | text t4_m2 "reason names x and y" |
| 287 | text t4_m3 "disjoint lifetimes fit" |
| 288 | text t4_m4 "peak 600" |
| 289 | text t4_m5 "oversized resident refuses" |
| 290 | |
| 291 | fn test_capacity_refusal to void |
| 292 | d = u_day u_d20 |
| 293 | rc = u_eval_body t4_b1 d 0 |
| 294 | u_check eq rc 4 t4_m1 |
| 295 | u_check and u_rsn_has t4_sx u_rsn_has t4_sy t4_m2 |
| 296 | rc = u_eval_body t4_b2 d 0 |
| 297 | u_check eq rc 0 t4_m3 |
| 298 | u_check u_near bitcast f64 get ds_sc 6344 600.0f64 1.0e-9f64 t4_m4 |
| 299 | rc = u_eval_body t4_b3 d 0 |
| 300 | u_check eq rc 4 t4_m5 |
| 301 | end |
| 302 | |
| 303 | note ---- 5. test_lifetimes ---- |
| 304 | text t5_b1 "resource id=cpu kind=compute slots=1 prov=specified src=test\nop id=A kind=compute engine=cpu t_ns=10 prov=measured src=t\nop id=B kind=compute engine=cpu t_ns=10 prov=measured src=t\nop id=C kind=compute engine=cpu t_ns=10 prov=measured src=t\ndep A B\ndep B C\nbuffer id=resident bytes=100 cap=mem\nbuffer id=x bytes=300 cap=mem first=A last=B\nbuffer id=y bytes=400 cap=mem first=B last=C\n" |
| 305 | text t5_m1 "lifetimes status" |
| 306 | text t5_m2 "peak 800" |
| 307 | text t5_m3 "peak at 10" |
| 308 | |
| 309 | fn test_lifetimes to void |
| 310 | rc = u_eval_body t5_b1 u_day u_d20 0 |
| 311 | u_check eq rc 0 t5_m1 |
| 312 | u_check u_near bitcast f64 get ds_sc 6344 800.0f64 1.0e-9f64 t5_m2 |
| 313 | u_check u_near bitcast f64 get ds_sc 6376 10.0f64 1.0e-9f64 t5_m3 |
| 314 | end |
| 315 | |
| 316 | note ---- 6. test_sync ---- |
| 317 | text t6_b1 "resource id=cpu kind=compute slots=2 prov=specified src=test\nop id=A kind=compute engine=cpu t_ns=10 prov=measured src=t\nop id=B kind=compute engine=cpu t_ns=30 prov=measured src=t\nop id=C kind=compute engine=cpu t_ns=5 prov=measured src=t\nsync id=s ops=A,B\ndep s C\n" |
| 318 | text t6_b2 "resource id=cpu kind=compute slots=2 prov=specified src=test\nop id=A kind=compute engine=cpu t_ns=10 prov=measured src=t\nop id=B kind=compute engine=cpu t_ns=30 prov=measured src=t\nop id=fence kind=barrier t_ns=7 prov=measured src=t\nop id=C kind=compute engine=cpu t_ns=5 prov=measured src=t\ndep A fence\ndep B fence\ndep fence C\n" |
| 319 | text t6_c "C" |
| 320 | text t6_m1 "sync status" |
| 321 | text t6_m2 "C waits for slower of A,B" |
| 322 | text t6_m3 "sync makespan 35" |
| 323 | text t6_m4 "costed barrier makespan 42" |
| 324 | text t6_m5 "sync attribution 7" |
| 325 | |
| 326 | fn test_sync to void |
| 327 | d = u_day u_d20 |
| 328 | rc = u_eval_body t6_b1 d 0 |
| 329 | u_check eq rc 0 t6_m1 |
| 330 | ci = ds_find_op_name t6_c |
| 331 | u_check and ge ci 0 u_near bitcast f64 get ds_sc add 4512 ulong ci 30.0f64 1.0e-9f64 t6_m2 |
| 332 | u_check u_near bitcast f64 get ds_sc 3 35.0f64 1.0e-9f64 t6_m3 |
| 333 | rc = u_eval_body t6_b2 d 0 |
| 334 | u_check and eq rc 0 u_near bitcast f64 get ds_sc 3 42.0f64 1.0e-9f64 t6_m4 |
| 335 | u_check u_near bitcast f64 get ds_sc 5829 7.0f64 1.0e-9f64 t6_m5 |
| 336 | end |
| 337 | |
| 338 | note ---- 7. test_launch ---- |
| 339 | text t7_b1 "resource id=gpu kind=compute slots=1 prov=specified src=test\nresource id=L kind=launch prov=measured src=t\nop id=A kind=compute engine=gpu t_ns=0 launch_ns=40e6 launcher=L prov=measured src=t\nop id=B kind=compute engine=gpu t_ns=0 launch_ns=40e6 launcher=L prov=measured src=t\n" |
| 340 | text t7_b2 "resource id=gpu kind=compute slots=1 prov=specified src=test\nresource id=cpu kind=compute slots=1 prov=specified src=test\nresource id=L1 kind=launch prov=measured src=t\nresource id=L2 kind=launch prov=measured src=t\nop id=A kind=compute engine=gpu t_ns=0 launch_ns=40e6 launcher=L1 prov=measured src=t\nop id=B kind=compute engine=cpu t_ns=0 launch_ns=40e6 launcher=L2 prov=measured src=t\n" |
| 341 | text t7_m1 "serialized launches add" |
| 342 | text t7_m2 "launch+serialization" |
| 343 | text t7_m3 "independent launches overlap" |
| 344 | |
| 345 | fn test_launch to void |
| 346 | d = u_day u_d20 |
| 347 | rc = u_eval_body t7_b1 d 0 |
| 348 | u_check and eq rc 0 u_near bitcast f64 get ds_sc 3 80.0e6f64 1.0e-3f64 t7_m1 |
| 349 | u_check u_near add bitcast f64 get ds_sc 5827 bitcast f64 get ds_sc 5828 80.0e6f64 1.0e-3f64 t7_m2 |
| 350 | rc = u_eval_body t7_b2 d 0 |
| 351 | u_check and eq rc 0 u_near bitcast f64 get ds_sc 3 40.0e6f64 1.0e-3f64 t7_m3 |
| 352 | end |
| 353 | |
| 354 | note ---- 8. test_calibration ---- |
| 355 | text t8_b1 "resource id=cpu kind=compute slots=1 prov=specified src=test\nop id=A kind=compute engine=cpu t_ns=10 prov=measured src=t\n" |
| 356 | text t8_nocal "oev version=1\nmachine id=t soc=t cores=4 mem_bytes=1000 prov=specified src=test\nbuild repo=omega-mv sha=0000000000000000000000000000000000000000\nenergy instrument=none\n" |
| 357 | text t8_unk "resource id=cpu kind=compute slots=1 prov=specified src=test\nop id=A kind=compute engine=cpu t_ns=10 prov=measured src=t\nop id=B kind=compute engine=cpu prov=unknown src=arch-244-not-run\ndep A B\n" |
| 358 | text t8_syn "resource id=cpu kind=compute slots=1 prov=specified src=test\nop id=A kind=compute engine=cpu t_ns=10 prov=synthetic src=t\n" |
| 359 | text t8_sb "B" |
| 360 | text t8_m1 "31 days stale refuses" |
| 361 | text t8_m2 "30 days valid OK" |
| 362 | text t8_m3 "parse without calibration" |
| 363 | text t8_m4 "measured without calibration refuses" |
| 364 | text t8_m5 "unknown op refuses" |
| 365 | text t8_m6 "reason names B" |
| 366 | text t8_m7 "no makespan on refusal" |
| 367 | text t8_m8 "synthetic flag" |
| 368 | |
| 369 | fn test_calibration to void |
| 370 | rc = u_eval_body t8_b1 u_day u_dnov19 0 |
| 371 | u_check eq rc 2 t8_m1 |
| 372 | rc = u_eval_body t8_b1 u_day u_dnov18 0 |
| 373 | u_check eq rc 0 t8_m2 |
| 374 | u_set_txt 0 t8_nocal t8_b1 |
| 375 | u_check eq ds_parse_side 0 0 t8_m3 |
| 376 | rc = ds_eval_current 0 u_day u_d20 0 bitcast ulong 0.9f64 |
| 377 | u_check eq rc 3 t8_m4 |
| 378 | rc = u_eval_body t8_unk u_day u_d20 0 |
| 379 | u_check eq rc 1 t8_m5 |
| 380 | u_check u_rsn_has t8_sb t8_m6 |
| 381 | u_check eq get ds_sc 3 0 t8_m7 |
| 382 | rc = u_eval_body t8_syn u_day u_d20 0 |
| 383 | u_check and eq rc 0 eq get ds_sc 26 1 t8_m8 |
| 384 | end |
| 385 | |
| 386 | note ---- 9. test_intervals ---- |
| 387 | text t9_b1 "resource id=cpu kind=compute slots=2 prov=specified src=test\nresource id=pipe kind=bandwidth cap=1e9 lo=0.5e9 hi=2e9 prov=measured src=t\nop id=A kind=compute engine=cpu t_ns=100 lo=80 hi=150 prov=measured src=t\nop id=B kind=copy engine=cpu bytes=1e9 bw=pipe prov=measured src=t\ndep A B\n" |
| 388 | text t9_m1 "parse interval" |
| 389 | text t9_m2 "interval status" |
| 390 | text t9_m3 "nominal 100+1e9" |
| 391 | text t9_m4 "optimistic 80+0.5e9" |
| 392 | text t9_m5 "pessimistic 150+2e9" |
| 393 | |
| 394 | fn test_intervals to void |
| 395 | u_set_txt 0 u_hdr t9_b1 |
| 396 | u_check eq ds_parse_side 0 0 t9_m1 |
| 397 | d = u_day u_d20 |
| 398 | q = bitcast ulong 0.9f64 |
| 399 | rc = ds_eval_current 0 d 0 q |
| 400 | u_check eq rc 0 t9_m2 |
| 401 | u_check u_near bitcast f64 get ds_sc 3 add 100.0f64 1.0e9f64 1.0e-3f64 t9_m3 |
| 402 | rc = ds_eval_current 1 d 0 q |
| 403 | u_check and eq rc 0 u_near bitcast f64 get ds_sc 3 add 80.0f64 0.5e9f64 1.0e-3f64 t9_m4 |
| 404 | rc = ds_eval_current -1 d 0 q |
| 405 | u_check and eq rc 0 u_near bitcast f64 get ds_sc 3 add 150.0f64 2.0e9f64 1.0e-3f64 t9_m5 |
| 406 | end |
| 407 | |
| 408 | note ---- 10. test_energy ---- |
| 409 | text t10_b1 "resource id=cpu kind=compute slots=1 prov=specified src=test\nop id=A kind=compute engine=cpu t_ns=1e9 prov=measured src=t\n" |
| 410 | text t10_syn "oev version=1\nmachine id=t soc=t cores=4 mem_bytes=1000 prov=specified src=test\nbuild repo=omega-mv sha=0000000000000000000000000000000000000000\ncalibration id=c1 taken=2026-10-19 valid_days=30 load1=1.0 src=test\nresource id=cpu kind=compute slots=1 prov=specified src=test\nop id=A kind=compute engine=cpu t_ns=1e9 prov=measured src=t\nenergy instrument=tdp-guess boundary=soc power_w=100 prov=synthetic\n" |
| 411 | text t10_meas "oev version=1\nmachine id=t soc=t cores=4 mem_bytes=1000 prov=specified src=test\nbuild repo=omega-mv sha=0000000000000000000000000000000000000000\ncalibration id=c1 taken=2026-10-19 valid_days=30 load1=1.0 src=test\nresource id=cpu kind=compute slots=1 prov=specified src=test\nop id=A kind=compute engine=cpu t_ns=1e9 prov=measured src=t\nenergy instrument=cyberpower-ups-nut boundary=wall joules=42.5 prov=measured src=receipt.json\n" |
| 412 | text t10_bad "oev version=1\nmachine id=t soc=t cores=4 mem_bytes=1000 prov=specified src=test\nbuild repo=omega-mv sha=0000000000000000000000000000000000000000\nenergy instrument=none joules=42.5 prov=measured src=x\n" |
| 413 | text t10_empty "" |
| 414 | text t10_m1 "instrument=none means UNMEASURED" |
| 415 | text t10_m2 "parse synthetic energy" |
| 416 | text t10_m3 "synthetic power E=P*T 100 J" |
| 417 | text t10_m4 "parse measured energy" |
| 418 | text t10_m5 "measured joules pass through" |
| 419 | text t10_m6 "joules without instrument refused at parse" |
| 420 | |
| 421 | fn test_energy to void |
| 422 | d = u_day u_d20 |
| 423 | q = bitcast ulong 0.9f64 |
| 424 | rc = u_eval_body t10_b1 d 0 |
| 425 | ok = eq rc 0 |
| 426 | ok = and ok eq get ds_sc 22 0 |
| 427 | ok = and ok eq get ds_sc 23 0 |
| 428 | u_check ok t10_m1 |
| 429 | u_set_txt1 0 t10_syn |
| 430 | u_check eq ds_parse_side 0 0 t10_m2 |
| 431 | rc = ds_eval_current 0 d 0 q |
| 432 | ok = eq rc 0 |
| 433 | ok = and ok eq get ds_sc 23 1 |
| 434 | ok = and ok eq get ds_sc 22 0 |
| 435 | ok = and ok u_near bitcast f64 get ds_sc 24 100.0f64 1.0e-9f64 |
| 436 | ok = and ok eq get ds_sc 26 1 |
| 437 | u_check ok t10_m3 |
| 438 | u_set_txt1 0 t10_meas |
| 439 | u_check eq ds_parse_side 0 0 t10_m4 |
| 440 | rc = ds_eval_current 0 d 0 q |
| 441 | ok = eq rc 0 |
| 442 | ok = and ok eq get ds_sc 22 1 |
| 443 | ok = and ok u_near bitcast f64 get ds_sc 24 42.5f64 1.0e-9f64 |
| 444 | ok = and ok eq get ds_sc 26 0 |
| 445 | u_check ok t10_m5 |
| 446 | u_set_txt1 0 t10_bad |
| 447 | u_check eq ds_parse_side 0 9 t10_m6 |
| 448 | end |
| 449 | |
| 450 | note ---- 11. test_parse_and_cycles ---- |
| 451 | text t11_b1 "resource id=cpu kind=compute slots=1 prov=specified src=test\nbogus x=1\n" |
| 452 | text t11_b2 "resource id=cpu kind=compute slots=1 prov=specified src=test\nop id=A kind=compute engine=cpu t_ns=1 prov=measured src=t typo=3\n" |
| 453 | text t11_b3 "resource id=cpu kind=compute slots=1 prov=specified src=test\nop id=A kind=compute engine=cpu t_ns=1 src=t\n" |
| 454 | text t11_b4 "resource id=cpu kind=compute slots=1 prov=specified src=test\nop id=A kind=compute engine=cpu t_ns=1 prov=measured src=t\nop id=B kind=compute engine=cpu t_ns=1 prov=measured src=t\ndep A B\ndep B A\n" |
| 455 | text t11_l8 "line 8" |
| 456 | text t11_fix "tests/dagsim/fixtures/m1_spark_subset.oev" |
| 457 | text t11_m1 "unknown keyword error with line 8" |
| 458 | text t11_m2 "unknown field error" |
| 459 | text t11_m3 "number without prov error" |
| 460 | text t11_m4 "cycle refuses" |
| 461 | text t11_m5 "fixture evaluates" |
| 462 | text t11_m6 "fixture serial makespan" |
| 463 | text t11_m7 "fixture energy UNMEASURED" |
| 464 | |
| 465 | fn test_parse_and_cycles to void |
| 466 | d = u_day u_d20 |
| 467 | u_set_txt 0 u_hdr t11_b1 |
| 468 | u_check and eq ds_parse_side 0 9 u_err_has t11_l8 t11_m1 |
| 469 | u_set_txt 0 u_hdr t11_b2 |
| 470 | u_check eq ds_parse_side 0 9 t11_m2 |
| 471 | u_set_txt 0 u_hdr t11_b3 |
| 472 | u_check eq ds_parse_side 0 9 t11_m3 |
| 473 | rc = u_eval_body t11_b4 d 0 |
| 474 | u_check eq rc 5 t11_m4 |
| 475 | rc = u_eval_file t11_fix d |
| 476 | u_check eq rc 0 t11_m5 |
| 477 | u_check u_near bitcast f64 get ds_sc 3 151756700.0f64 1.0e-3f64 t11_m6 |
| 478 | u_check and eq get ds_sc 22 0 eq get ds_sc 23 0 t11_m7 |
| 479 | end |
| 480 | |
| 481 | note ---- 12. test_costmodel_reuse ---- |
| 482 | text t12_b1 "resource id=cpu kind=compute slots=1 prov=specified src=test\nop id=mv kind=matvec engine=cpu M=64 N=16 core=0 arm=0 prov=fitted src=rx_costmodel\n" |
| 483 | text t12_b2 "resource id=cpu kind=compute slots=1 prov=specified src=test\nop id=mv kind=matvec engine=cpu M=64 N=16 core=0 arm=1 prov=fitted src=rx_costmodel\n" |
| 484 | text t12_m1 "parse matvec" |
| 485 | text t12_m2 "matvec with no model refuses" |
| 486 | text t12_m3 "matvec with model OK" |
| 487 | text t12_m4 "cell known" |
| 488 | text t12_m5 "time from rx_cm_predict" |
| 489 | text t12_m6 "fitted provenance recorded" |
| 490 | text t12_m7 "parse unobserved arm" |
| 491 | text t12_m8 "unobserved arm refuses" |
| 492 | |
| 493 | fn t12_train_cm to void |
| 494 | ds_cm_init 2 |
| 495 | rng = or shl ulong 2654435769 32 ulong 2135587861 |
| 496 | for i ulong 200 |
| 497 | rng = xor rng shl rng 13 |
| 498 | rng = xor rng shr rng 7 |
| 499 | rng = xor rng shl rng 17 |
| 500 | M = add 8 rem rng 120 |
| 501 | N = add 4 rem shr rng 20 60 |
| 502 | sb = mul add add mul M N M N 8 |
| 503 | put ds_cm_feat 0 0 |
| 504 | put ds_cm_feat 1 M |
| 505 | put ds_cm_feat 2 N |
| 506 | put ds_cm_feat 3 sb |
| 507 | put ds_cm_feat 4 1048576 |
| 508 | put ds_cm_feat 5 0 |
| 509 | put ds_cm_feat 6 0 |
| 510 | l2 = add 10.0f64 mul 0.95f64 add ds_log2 f64 M ds_log2 f64 N |
| 511 | ps = ulong ds_exp2 l2 |
| 512 | st = ds_cm_observe_feat 0 ps 0 |
| 513 | end |
| 514 | end |
| 515 | |
| 516 | fn test_costmodel_reuse to void |
| 517 | t12_train_cm |
| 518 | d = u_day u_d20 |
| 519 | q = bitcast ulong 0.9f64 |
| 520 | u_set_txt 0 u_hdr t12_b1 |
| 521 | u_check eq ds_parse_side 0 0 t12_m1 |
| 522 | rc = ds_eval_current 0 d 0 q |
| 523 | u_check eq rc 1 t12_m2 |
| 524 | rc = ds_eval_current 0 d 1 q |
| 525 | u_check eq rc 0 t12_m3 |
| 526 | put ds_cm_feat 0 0 |
| 527 | put ds_cm_feat 1 64 |
| 528 | put ds_cm_feat 2 16 |
| 529 | put ds_cm_feat 3 mul add add mul ulong 64 16 64 16 8 |
| 530 | put ds_cm_feat 4 1048576 |
| 531 | put ds_cm_feat 5 0 |
| 532 | put ds_cm_feat 6 0 |
| 533 | pst = ds_cm_predict_feat 0 |
| 534 | u_check eq get ds_cm_pred 4 1 t12_m4 |
| 535 | exp_ns = div ds_exp2 bitcast f64 get ds_cm_pred 0 1000.0f64 |
| 536 | u_check u_near bitcast f64 get ds_sc 3 exp_ns 1.0e-6f64 t12_m5 |
| 537 | u_check ne and get ds_sc 11 4 0 t12_m6 |
| 538 | u_set_txt 0 u_hdr t12_b2 |
| 539 | u_check eq ds_parse_side 0 0 t12_m7 |
| 540 | rc = ds_eval_current 0 d 1 q |
| 541 | u_check eq rc 1 t12_m8 |
| 542 | end |
| 543 | |
| 544 | note ---- 13. test_predict_refusal (#934 + mutant_predict.sh) ---- |
| 545 | text t13_m1 "real predict refuses unsupported op" |
| 546 | text t13_m2 "parse predict refusal" |
| 547 | text t13_m3 "predict_unsupported_despite_known" |
| 548 | text t13_m4 "predict_refused_despite_known" |
| 549 | |
| 550 | fn test_predict_refusal to void |
| 551 | ds_cm_init 1 |
| 552 | put ds_cm_feat 0 1 |
| 553 | put ds_cm_feat 1 64 |
| 554 | put ds_cm_feat 2 16 |
| 555 | put ds_cm_feat 3 0 |
| 556 | put ds_cm_feat 4 0 |
| 557 | put ds_cm_feat 5 0 |
| 558 | put ds_cm_feat 6 0 |
| 559 | st = ds_cm_predict_feat 0 |
| 560 | ok0 = eq st -4 |
| 561 | ok0 = and ok0 eq get ds_cm_pred 5 1 |
| 562 | ok0 = and ok0 eq get ds_cm_pred 4 0 |
| 563 | ok0 = and ok0 eq get ds_cm_pred 3 0 |
| 564 | u_check ok0 t13_m1 |
| 565 | d = u_day u_d20 |
| 566 | q = bitcast ulong 0.9f64 |
| 567 | u_set_txt 0 u_hdr t12_b1 |
| 568 | u_check eq ds_parse_side 0 0 t13_m2 |
| 569 | put ds_pred_fault 0 1 |
| 570 | rc = ds_eval_current 0 d 1 q |
| 571 | put ds_pred_fault 0 0 |
| 572 | u_check and eq rc 1 eq get ds_sc 3 0 t13_m3 |
| 573 | put ds_pred_fault 0 2 |
| 574 | rc = ds_eval_current 0 d 1 q |
| 575 | put ds_pred_fault 0 0 |
| 576 | u_check and eq rc 1 eq get ds_sc 3 0 t13_m4 |
| 577 | end |
| 578 | |
| 579 | note ---- 14. test_counterfactual ---- |
| 580 | text t14_pipe "pipe" |
| 581 | text t14_cpu "cpu" |
| 582 | text t14_m1 "cf status" |
| 583 | text t14_m2 "doubling pipe halves makespan" |
| 584 | text t14_m3 "doubling slots changes nothing" |
| 585 | |
| 586 | fn test_counterfactual to void |
| 587 | d = u_day u_d20 |
| 588 | q = bitcast ulong 0.9f64 |
| 589 | rc = u_eval_body t3_b1 d 0 |
| 590 | u_check eq rc 0 t14_m1 |
| 591 | pi = ds_find_res_name t14_pipe |
| 592 | cf1 = ds_counterfactual_idx pi d 0 q |
| 593 | u_check u_near cf1 1.0e9f64 1.0e-3f64 t14_m2 |
| 594 | ci = ds_find_res_name t14_cpu |
| 595 | cf2 = ds_counterfactual_idx ci d 0 q |
| 596 | u_check u_near cf2 2.0e9f64 1.0e-3f64 t14_m3 |
| 597 | end |
| 598 | |
| 599 | note ---- 15. test_minimum_work_diff ---- |
| 600 | text t15_base "resource id=cpu kind=compute slots=1 prov=specified src=test\nop id=A kind=compute engine=cpu t_ns=10 prov=measured src=t\nop id=B kind=compute engine=cpu t_ns=20 prov=measured src=t\nop id=C kind=compute engine=cpu t_ns=30 prov=measured src=t\ndep A B\ndep B C\n" |
| 601 | text t15_tr2 "resource id=cpu kind=compute slots=1 prov=specified src=test\nop id=A kind=compute engine=cpu t_ns=10 prov=measured src=t\nop id=B_lookup kind=compute engine=cpu t_ns=2 prov=measured src=t\nop id=C kind=compute engine=cpu t_ns=30 prov=measured src=t\ndep A B_lookup\ndep B_lookup C\nremoved op=B reason=reused ref=B_lookup proof=rx_plan:digest\n" |
| 602 | text t15_tr3 "resource id=cpu kind=compute slots=1 prov=specified src=test\nop id=A kind=compute engine=cpu t_ns=10 prov=measured src=t\nop id=C kind=compute engine=cpu t_ns=30 prov=measured src=t\ndep A C\nremoved op=B reason=eliminated\n" |
| 603 | text t15_tr4 "resource id=cpu kind=compute slots=1 prov=specified src=test\nop id=A kind=compute engine=cpu t_ns=10 prov=measured src=t\nop id=C kind=compute engine=cpu t_ns=30 prov=measured src=t\ndep A C\nremoved op=B reason=unchanged_dep ref=A\n" |
| 604 | text t15_tr5 "resource id=cpu kind=compute slots=1 prov=specified src=test\nop id=A kind=compute engine=cpu t_ns=10 prov=measured src=t\nop id=C kind=compute engine=cpu t_ns=30 prov=measured src=t\ndep A C\nremoved op=B reason=shared ref=A\nremoved op=B reason=shared ref=C\n" |
| 605 | text t15_chA "A" |
| 606 | text t15_m1 "base parse" |
| 607 | text t15_m2 "tr1 parse" |
| 608 | text t15_m3 "no-change diff" |
| 609 | text t15_m4 "tr2 parse" |
| 610 | text t15_m5 "reuse accounted" |
| 611 | text t15_m6 "tr3 parse" |
| 612 | text t15_m7 "unproven elimination refuses" |
| 613 | text t15_m8 "tr4 parse" |
| 614 | text t15_m9 "unchanged_dep allows skip" |
| 615 | text t15_m10 "changed A invalidates skip" |
| 616 | text t15_m11 "tr5 parse" |
| 617 | text t15_m12 "double-counted shared detected" |
| 618 | |
| 619 | fn u_diff_run to ulong |
| 620 | ds_pack_side 0 |
| 621 | ds_pack_side 1 |
| 622 | for i ulong 64 |
| 623 | put ds_ra i 0 |
| 624 | end |
| 625 | ret ds_run_diff |
| 626 | end |
| 627 | |
| 628 | fn test_minimum_work_diff to void |
| 629 | u_set_txt 0 u_hdr t15_base |
| 630 | u_check eq ds_parse_side 0 0 t15_m1 |
| 631 | u_set_txt 1 u_hdr t15_base |
| 632 | u_check eq ds_parse_side 1 0 t15_m2 |
| 633 | rc = u_diff_run |
| 634 | u_check and eq rc 0 and eq get ds_ra 12 0 and eq get ds_ra 10 0 eq get ds_ra 11 3 t15_m3 |
| 635 | u_set_txt 1 u_hdr t15_tr2 |
| 636 | u_check eq ds_parse_side 1 0 t15_m4 |
| 637 | rc = u_diff_run |
| 638 | u_check and eq rc 0 and u_near bitcast f64 get ds_ra 34 20.0f64 1.0e-9f64 eq get ds_ra 10 1 t15_m5 |
| 639 | u_set_txt 1 u_hdr t15_tr3 |
| 640 | u_check eq ds_parse_side 1 0 t15_m6 |
| 641 | rc = u_diff_run |
| 642 | u_check and eq rc 7 ne get ds_ra 14 0 t15_m7 |
| 643 | u_set_txt 1 u_hdr t15_tr4 |
| 644 | u_check eq ds_parse_side 1 0 t15_m8 |
| 645 | rc = u_diff_run |
| 646 | u_check and eq rc 0 u_near bitcast f64 get ds_ra 35 20.0f64 1.0e-9f64 t15_m9 |
| 647 | ds_pack_side 0 |
| 648 | ds_pack_side 1 |
| 649 | ds_mark_changed t15_chA len t15_chA |
| 650 | for i ulong 64 |
| 651 | put ds_ra i 0 |
| 652 | end |
| 653 | rc = ds_run_diff |
| 654 | u_check eq rc 7 t15_m10 |
| 655 | u_set_txt 1 u_hdr t15_tr5 |
| 656 | u_check eq ds_parse_side 1 0 t15_m11 |
| 657 | rc = u_diff_run |
| 658 | u_check and ne rc 0 ne get ds_ra 13 0 t15_m12 |
| 659 | end |
| 660 | |
| 661 | note ---- 16. test_inverted_lifetimes (#705 + mutant_lifetime.sh) ---- |
| 662 | text t16_f1 "tests/dagsim/fixtures/inverted_masks_overflow.oev" |
| 663 | text t16_f2 "tests/dagsim/fixtures/inverted_lone.oev" |
| 664 | text t16_f3 "tests/dagsim/fixtures/capacity_two_80.oev" |
| 665 | text t16_f4 "tests/dagsim/fixtures/valid_disjoint_80.oev" |
| 666 | text t16_f5 "tests/dagsim/fixtures/valid_tie_80.oev" |
| 667 | text t16_s_inv "inverted lifetime for buffer inverted:" |
| 668 | text t16_s_fc "first=C" |
| 669 | text t16_s_s20 "start_ns=20" |
| 670 | text t16_s_la "last=A" |
| 671 | text t16_s_e10 "end_ns=10" |
| 672 | text t16_s_neg "went negative" |
| 673 | text t16_s_r1 "real1" |
| 674 | text t16_s_r2 "real2" |
| 675 | text t16_s_mem "mem" |
| 676 | text t16_s_hbm "hbm" |
| 677 | text t16_s_fin "finite number >= 0" |
| 678 | text t16_s_nop "not an op" |
| 679 | |
| 680 | text t16_z1 "resource id=cpu kind=compute slots=1 prov=specified src=test\nop id=Z kind=compute engine=cpu t_ns=0 prov=measured src=t\nbuffer id=z bytes=80 cap=mem first=Z last=Z\n" |
| 681 | text t16_z2 "resource id=cpu kind=compute slots=1 prov=specified src=test\nop id=Z kind=compute engine=cpu t_ns=0 prov=measured src=t\nop id=B kind=compute engine=cpu t_ns=10 prov=measured src=t\nbuffer id=z bytes=400 cap=mem first=Z last=Z\nbuffer id=real1 bytes=600 cap=mem first=B last=B\nbuffer id=real2 bytes=600 cap=mem first=B last=B\n" |
| 682 | text t16_om "resource id=cpu kind=compute slots=1 prov=specified src=test\nop id=A kind=compute engine=cpu t_ns=10 prov=measured src=t\nbuffer id=no_first bytes=100 cap=mem last=A\nbuffer id=no_last bytes=50 cap=mem first=A\nbuffer id=resident bytes=25 cap=mem\n" |
| 683 | text t16_rnd "resource id=cpu kind=compute slots=1 prov=specified src=test\nresource id=hbm kind=capacity cap=1e30 prov=specified src=test\nop id=A kind=compute engine=cpu t_ns=10 prov=measured src=t\nop id=B kind=compute engine=cpu t_ns=10 prov=measured src=t\nop id=C kind=compute engine=cpu t_ns=10 prov=measured src=t\ndep A B\ndep B C\nbuffer id=huge bytes=1e20 cap=hbm first=A last=B\nbuffer id=tiny bytes=1 cap=hbm first=B last=C\n" |
| 684 | text t16_p1 "buffer id=neg bytes=-5 cap=mem\n" |
| 685 | text t16_p2 "buffer id=inf bytes=inf cap=mem\n" |
| 686 | text t16_p3 "resource id=cpu kind=compute slots=1 prov=specified src=test\nop id=A kind=compute engine=cpu t_ns=10 prov=measured src=t\nbuffer id=ghost bytes=10 cap=mem first=nope last=A\n" |
| 687 | |
| 688 | text t16_m1 "inverted_lifetime_masks_overflow" |
| 689 | text t16_m2 "refusal carries no capacity certificate" |
| 690 | text t16_m3 "rejection text is deterministic" |
| 691 | text t16_m4 "lone inverted lifetime refused" |
| 692 | text t16_m5 "two valid 80 B buffers refuse capacity" |
| 693 | text t16_m6 "disjoint 80 B pair fits" |
| 694 | text t16_m7 "disjoint peak 80" |
| 695 | text t16_m8 "disjoint makespan 30" |
| 696 | text t16_m9 "tie fits" |
| 697 | text t16_m10 "tie peak 80" |
| 698 | text t16_m11 "zero-duration status" |
| 699 | text t16_m12 "zero-duration peak 0" |
| 700 | text t16_m13 "zero-duration must not hide 1200 B" |
| 701 | text t16_m14 "omitted endpoints status" |
| 702 | text t16_m15 "omitted endpoints peak 175" |
| 703 | text t16_m16 "rounding_drives_live_negative" |
| 704 | text t16_m17 "negative-ledger carries no capacity certificate" |
| 705 | text t16_m18 "negative bytes refused at parse" |
| 706 | text t16_m19 "non-finite bytes refused at parse" |
| 707 | text t16_m20 "unknown endpoint refused at parse" |
| 708 | |
| 709 | fn t16_peak_of s view uchar * to f64 |
| 710 | i = ds_find_res_name s |
| 711 | if lt i 0 |
| 712 | ret -1.0f64 |
| 713 | end |
| 714 | ret bitcast f64 get ds_sc add 6344 ulong i |
| 715 | end |
| 716 | |
| 717 | fn test_inverted_part1 to void |
| 718 | d24 = u_day u_d24 |
| 719 | rc = u_eval_file t16_f1 d24 |
| 720 | ok1 = eq rc 8 |
| 721 | ok1 = and ok1 u_rsn_has t16_s_inv |
| 722 | ok1 = and ok1 u_rsn_has t16_s_fc |
| 723 | ok1 = and ok1 u_rsn_has t16_s_s20 |
| 724 | ok1 = and ok1 u_rsn_has t16_s_la |
| 725 | ok1 = and ok1 u_rsn_has t16_s_e10 |
| 726 | ok1 = and ok1 not u_rsn_has t16_s_neg |
| 727 | u_check ok1 t16_m1 |
| 728 | u_check and eq get ds_sc 3 0 eq get ds_sc 6344 0 t16_m2 |
| 729 | rlen1 = get ds_reason_len 0 |
| 730 | put u_rsn2_len 0 rlen1 |
| 731 | for i ulong rlen1 bound 256 |
| 732 | put u_rsn2 i get ds_reason i |
| 733 | end |
| 734 | rc2 = u_eval_file t16_f1 d24 |
| 735 | same = and eq rc rc2 eq rlen1 get ds_reason_len 0 |
| 736 | if same |
| 737 | for i ulong rlen1 bound 256 |
| 738 | if ne get u_rsn2 i get ds_reason i |
| 739 | same = false |
| 740 | break |
| 741 | end |
| 742 | end |
| 743 | end |
| 744 | u_check same t16_m3 |
| 745 | rc = u_eval_file t16_f2 d24 |
| 746 | u_check and eq rc 8 and u_rsn_has t16_s_fc u_rsn_has t16_s_la t16_m4 |
| 747 | rc = u_eval_file t16_f3 d24 |
| 748 | u_check and eq rc 4 and u_rsn_has t16_s_r1 u_rsn_has t16_s_r2 t16_m5 |
| 749 | rc = u_eval_file t16_f4 d24 |
| 750 | u_check eq rc 0 t16_m6 |
| 751 | u_check u_near t16_peak_of t16_s_mem 80.0f64 1.0e-9f64 t16_m7 |
| 752 | u_check u_near bitcast f64 get ds_sc 3 30.0f64 1.0e-9f64 t16_m8 |
| 753 | rc = u_eval_file t16_f5 d24 |
| 754 | u_check eq rc 0 t16_m9 |
| 755 | u_check u_near t16_peak_of t16_s_mem 80.0f64 1.0e-9f64 t16_m10 |
| 756 | end |
| 757 | |
| 758 | fn test_inverted_part2 to void |
| 759 | d20 = u_day u_d20 |
| 760 | rc = u_eval_body t16_z1 d20 0 |
| 761 | u_check eq rc 0 t16_m11 |
| 762 | u_check u_near bitcast f64 get ds_sc 6344 0.0f64 1.0e-9f64 t16_m12 |
| 763 | rc = u_eval_body t16_z2 d20 0 |
| 764 | u_check eq rc 4 t16_m13 |
| 765 | rc = u_eval_body t16_om d20 0 |
| 766 | u_check eq rc 0 t16_m14 |
| 767 | u_check u_near bitcast f64 get ds_sc 6344 175.0f64 1.0e-9f64 t16_m15 |
| 768 | rc = u_eval_body t16_rnd d20 0 |
| 769 | u_check and eq rc 8 u_rsn_has t16_s_neg t16_m16 |
| 770 | u_check and u_near t16_peak_of t16_s_hbm 0.0f64 1.0e-9f64 eq get ds_sc 3 0 t16_m17 |
| 771 | u_set_txt 0 u_hdr t16_p1 |
| 772 | u_check and eq ds_parse_side 0 9 u_err_has t16_s_fin t16_m18 |
| 773 | u_set_txt 0 u_hdr t16_p2 |
| 774 | u_check and eq ds_parse_side 0 9 u_err_has t16_s_fin t16_m19 |
| 775 | u_set_txt 0 u_hdr t16_p3 |
| 776 | u_check and eq ds_parse_side 0 9 u_err_has t16_s_nop t16_m20 |
| 777 | end |
| 778 | |
| 779 | fn main to int |
| 780 | test_serial_chain |
| 781 | test_perfect_overlap |
| 782 | test_shared_bandwidth |
| 783 | test_capacity_refusal |
| 784 | test_lifetimes |
| 785 | test_sync |
| 786 | test_launch |
| 787 | test_calibration |
| 788 | test_intervals |
| 789 | test_energy |
| 790 | test_parse_and_cycles |
| 791 | test_costmodel_reuse |
| 792 | test_predict_refusal |
| 793 | test_counterfactual |
| 794 | test_minimum_work_diff |
| 795 | test_inverted_part1 |
| 796 | test_inverted_part2 |
| 797 | ds_out_reset |
| 798 | ds_out_text u_sum1 |
| 799 | ds_out_u64 get u_checks 0 |
| 800 | ds_out_text u_sum2 |
| 801 | ds_out_u64 get u_fail 0 |
| 802 | ds_out_text u_sum3 |
| 803 | ds_out_flush 1 |
| 804 | if ne get u_fail 0 0 |
| 805 | ret 1 |
| 806 | end |
| 807 | ret 0 |
| 808 | end |