nmarshall commited on
Commit
8c0a4c8
·
1 Parent(s): fbab93d

qvm: recover rank partition helpers

Browse files
docs/ASSET_PIPELINE_TODO.md CHANGED
@@ -1015,3 +1015,6 @@ Research progress: RE-786 [report](research/QVM_COUNTER_REENTRY.md); original as
1015
 
1016
 
1017
  Research progress: RE-787 [report](research/QVM_MOVEMENT_REENTRY.md); original assets unchanged.
 
 
 
 
1015
 
1016
 
1017
  Research progress: RE-787 [report](research/QVM_MOVEMENT_REENTRY.md); original assets unchanged.
1018
+
1019
+
1020
+ Research progress: RE-788 [report](research/QVM_RANK_PARTITION_HELPERS.md); original assets unchanged.
docs/FINDINGS.md CHANGED
@@ -1361,3 +1361,6 @@ RE-725–734 batch: [health, contact and Rust impulse findings](research/QVM_HEA
1361
 
1362
 
1363
  **RE-787 — Audited water-entry dynamic returns and locomotion source consumers:** 41486 and selected47884 prefix/ground paths use corrected movement execution, with full returned-memory differential checks and independent water/gait/event expectations. [Evidence](research/QVM_MOVEMENT_REENTRY.md).
 
 
 
 
1361
 
1362
 
1363
  **RE-787 — Audited water-entry dynamic returns and locomotion source consumers:** 41486 and selected47884 prefix/ground paths use corrected movement execution, with full returned-memory differential checks and independent water/gait/event expectations. [Evidence](research/QVM_MOVEMENT_REENTRY.md).
1364
+
1365
+
1366
+ **RE-788 — Actual aligned sort swaps and dynamic median-of-three helper:** Recovered34829 aligned swaps and34964 median-of-three with five reviewed return destinations; tests cover overlap, guards, permutations and ties. [Evidence](research/QVM_RANK_PARTITION_HELPERS.md).
docs/PROVISIONAL_TODO.md CHANGED
@@ -1362,3 +1362,6 @@ Research progress: RE-786 [report](research/QVM_COUNTER_REENTRY.md); full native
1362
 
1363
 
1364
  Research progress: RE-787 [report](research/QVM_MOVEMENT_REENTRY.md); full native/platform/game scope remains open.
 
 
 
 
1362
 
1363
 
1364
  Research progress: RE-787 [report](research/QVM_MOVEMENT_REENTRY.md); full native/platform/game scope remains open.
1365
+
1366
+
1367
+ Research progress: RE-788 [report](research/QVM_RANK_PARTITION_HELPERS.md); full native/platform/game scope remains open.
docs/RESEARCH_LEDGER.md CHANGED
@@ -1597,3 +1597,8 @@ The movement resumer also loses non-command STORE1 writes across calls in legacy
1597
  ## 2026-10-21 — RE-787 Audited water-entry dynamic returns and locomotion source consumers
1598
 
1599
  41486 and selected47884 prefix/ground paths use corrected movement execution, with full returned-memory differential checks and independent water/gait/event expectations. Focused `cargo xtask test-group movement-reentry` passes (65 Python tests); selected reports regenerate twice byte-identically, with storage, links and whitespace guards. New report: 413676 bytes. Full-suite validation is deferred to the tenth batch commit. Selected movement producers migrated; the shared execute default remains legacy during the wider audit.
 
 
 
 
 
 
1597
  ## 2026-10-21 — RE-787 Audited water-entry dynamic returns and locomotion source consumers
1598
 
1599
  41486 and selected47884 prefix/ground paths use corrected movement execution, with full returned-memory differential checks and independent water/gait/event expectations. Focused `cargo xtask test-group movement-reentry` passes (65 Python tests); selected reports regenerate twice byte-identically, with storage, links and whitespace guards. New report: 413676 bytes. Full-suite validation is deferred to the tenth batch commit. Selected movement producers migrated; the shared execute default remains legacy during the wider audit.
1600
+
1601
+
1602
+ ## 2026-10-21 — RE-788 Actual aligned sort swaps and dynamic median-of-three helper
1603
+
1604
+ Recovered34829 aligned swaps and34964 median-of-three with five reviewed return destinations; tests cover overlap, guards, permutations and ties. Focused `cargo xtask test-group rank-partition-helpers` passes (18 Python tests); selected reports regenerate twice byte-identically, with storage, links and whitespace guards. New report: 405895 bytes. Full-suite validation is deferred to the tenth batch commit. New bounded source helper compositions use corrected tracing and explicit dynamic return offsets; no supplied sort/median result is used.
docs/REVERSE_ENGINEERING_TODO.md CHANGED
@@ -1411,3 +1411,6 @@ Purpose: turn the supplied installation into an evidence-backed specification of
1411
 
1412
 
1413
  - [x] RE-787 Audited water-entry dynamic returns and locomotion source consumers ([report](research/QVM_MOVEMENT_REENTRY.md)).
 
 
 
 
1411
 
1412
 
1413
  - [x] RE-787 Audited water-entry dynamic returns and locomotion source consumers ([report](research/QVM_MOVEMENT_REENTRY.md)).
1414
+
1415
+
1416
+ - [x] RE-788 Actual aligned sort swaps and dynamic median-of-three helper ([report](research/QVM_RANK_PARTITION_HELPERS.md)).
docs/research/QVM_RANK_PARTITION_HELPERS.md ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ # Actual aligned sort swaps and dynamic median-of-three helper
2
+
3
+ RE-788. Reproduce with `python3 scripts/analyze_qvm_rank_partition_helpers.py`; validate with `cargo xtask test-group rank-partition-helpers`. See the [machine report](qvm-rank-partition-helpers.json).
4
+
5
+ Thirty swap probes use both aligned swap policies with4..256-byte lengths and self/overlapping/disjoint regions. The independent oracle performs sequential word exchanges, preserving forward-overlap behavior. Forty-eight median probes cover all three-client permutations, four modes and complete ties; the actual returned pointer selects a median comparator value without mutating the array or callback pointer. Comparator5441 now also opts into corrected resumption. These helpers prepare whole partitioned sort recovery; unaligned/byte swaps and arbitrary native comparators remain open.
6
+
7
+ No original executable/full VM/native world collision or rendering runs. Supplied callback/native responses and fixture domains remain explicit; complete macOS/Linux Rust/Bevy/Solari gameplay remains open.
8
+
9
+ Comparator migration corrects stop metadata in21 standalone and18 nested ranking observations: the reported PC now follows the actual LEAVE rather than defaulting to5863. Recursive JSON comparison and opcode checks confirm every other value and trace hash is unchanged; Rust report source digests refresh accordingly. Legacy segments without remaining stop targets had used the configured range end.
docs/research/README.md CHANGED
@@ -951,3 +951,6 @@ The extension collector adds five focused tests for native tail calls, command-r
951
 
952
 
953
  [RE-787: Audited water-entry dynamic returns and locomotion source consumers](QVM_MOVEMENT_REENTRY.md).
 
 
 
 
951
 
952
 
953
  [RE-787: Audited water-entry dynamic returns and locomotion source consumers](QVM_MOVEMENT_REENTRY.md).
954
+
955
+
956
+ [RE-788: Actual aligned sort swaps and dynamic median-of-three helper](QVM_RANK_PARTITION_HELPERS.md).
docs/research/qvm-rank-comparator.json CHANGED
@@ -38,7 +38,7 @@
38
  }
39
  ],
40
  "return": 0,
41
- "stop": 5863,
42
  "trace": null,
43
  "trace_length": 148,
44
  "trace_sha256": "c5b2803dbb723e8356d9da5bf5cb254182ca933da66ea24548acd05d34d2cb22"
@@ -861,7 +861,7 @@
861
  }
862
  ],
863
  "return": 0,
864
- "stop": 5863,
865
  "trace": null,
866
  "trace_length": 170,
867
  "trace_sha256": "e9bb717ea6416341ee124c4483bd2dc6b96f05b4257882ae02e768e76d824ce9"
@@ -2476,7 +2476,7 @@
2476
  }
2477
  ],
2478
  "return": 0,
2479
- "stop": 5863,
2480
  "trace": null,
2481
  "trace_length": 170,
2482
  "trace_sha256": "c40ca3a5fcb0f8093118b59692131aee7d92d92b9274f3080c5360e514c3240e"
@@ -3299,7 +3299,7 @@
3299
  }
3300
  ],
3301
  "return": 0,
3302
- "stop": 5863,
3303
  "trace": null,
3304
  "trace_length": 148,
3305
  "trace_sha256": "c5b2803dbb723e8356d9da5bf5cb254182ca933da66ea24548acd05d34d2cb22"
@@ -3480,7 +3480,7 @@
3480
  }
3481
  ],
3482
  "return": 0,
3483
- "stop": 5863,
3484
  "trace": null,
3485
  "trace_length": 148,
3486
  "trace_sha256": "c5b2803dbb723e8356d9da5bf5cb254182ca933da66ea24548acd05d34d2cb22"
@@ -3661,7 +3661,7 @@
3661
  }
3662
  ],
3663
  "return": 0,
3664
- "stop": 5863,
3665
  "trace": null,
3666
  "trace_length": 148,
3667
  "trace_sha256": "c5b2803dbb723e8356d9da5bf5cb254182ca933da66ea24548acd05d34d2cb22"
@@ -3842,7 +3842,7 @@
3842
  }
3843
  ],
3844
  "return": 0,
3845
- "stop": 5863,
3846
  "trace": null,
3847
  "trace_length": 148,
3848
  "trace_sha256": "c5b2803dbb723e8356d9da5bf5cb254182ca933da66ea24548acd05d34d2cb22"
@@ -3903,7 +3903,7 @@
3903
  }
3904
  ],
3905
  "return": 0,
3906
- "stop": 5863,
3907
  "trace": null,
3908
  "trace_length": 170,
3909
  "trace_sha256": "e9bb717ea6416341ee124c4483bd2dc6b96f05b4257882ae02e768e76d824ce9"
@@ -4084,7 +4084,7 @@
4084
  }
4085
  ],
4086
  "return": 0,
4087
- "stop": 5863,
4088
  "trace": null,
4089
  "trace_length": 170,
4090
  "trace_sha256": "e9bb717ea6416341ee124c4483bd2dc6b96f05b4257882ae02e768e76d824ce9"
@@ -4265,7 +4265,7 @@
4265
  }
4266
  ],
4267
  "return": 0,
4268
- "stop": 5863,
4269
  "trace": null,
4270
  "trace_length": 170,
4271
  "trace_sha256": "e9bb717ea6416341ee124c4483bd2dc6b96f05b4257882ae02e768e76d824ce9"
@@ -4446,7 +4446,7 @@
4446
  }
4447
  ],
4448
  "return": 0,
4449
- "stop": 5863,
4450
  "trace": null,
4451
  "trace_length": 170,
4452
  "trace_sha256": "e9bb717ea6416341ee124c4483bd2dc6b96f05b4257882ae02e768e76d824ce9"
@@ -4987,7 +4987,7 @@
4987
  }
4988
  ],
4989
  "return": 0,
4990
- "stop": 5863,
4991
  "trace": null,
4992
  "trace_length": 170,
4993
  "trace_sha256": "c40ca3a5fcb0f8093118b59692131aee7d92d92b9274f3080c5360e514c3240e"
@@ -5168,7 +5168,7 @@
5168
  }
5169
  ],
5170
  "return": 0,
5171
- "stop": 5863,
5172
  "trace": null,
5173
  "trace_length": 170,
5174
  "trace_sha256": "c40ca3a5fcb0f8093118b59692131aee7d92d92b9274f3080c5360e514c3240e"
@@ -5349,7 +5349,7 @@
5349
  }
5350
  ],
5351
  "return": 0,
5352
- "stop": 5863,
5353
  "trace": null,
5354
  "trace_length": 170,
5355
  "trace_sha256": "c40ca3a5fcb0f8093118b59692131aee7d92d92b9274f3080c5360e514c3240e"
@@ -5530,7 +5530,7 @@
5530
  }
5531
  ],
5532
  "return": 0,
5533
- "stop": 5863,
5534
  "trace": null,
5535
  "trace_length": 170,
5536
  "trace_sha256": "c40ca3a5fcb0f8093118b59692131aee7d92d92b9274f3080c5360e514c3240e"
@@ -5671,7 +5671,7 @@
5671
  }
5672
  ],
5673
  "return": 0,
5674
- "stop": 5863,
5675
  "trace": null,
5676
  "trace_length": 148,
5677
  "trace_sha256": "c5b2803dbb723e8356d9da5bf5cb254182ca933da66ea24548acd05d34d2cb22"
@@ -5722,7 +5722,7 @@
5722
  }
5723
  ],
5724
  "return": 0,
5725
- "stop": 5863,
5726
  "trace": null,
5727
  "trace_length": 148,
5728
  "trace_sha256": "c5b2803dbb723e8356d9da5bf5cb254182ca933da66ea24548acd05d34d2cb22"
@@ -5853,7 +5853,7 @@
5853
  }
5854
  ],
5855
  "return": 1,
5856
- "stop": 5863,
5857
  "trace": null,
5858
  "trace_length": 170,
5859
  "trace_sha256": "e8e910b1529f5d1a4d60d2df1a15d9022601021a4fefdebd1ad49edb547b659f"
@@ -5904,7 +5904,7 @@
5904
  }
5905
  ],
5906
  "return": -1,
5907
- "stop": 5863,
5908
  "trace": null,
5909
  "trace_length": 159,
5910
  "trace_sha256": "fa43856637143c0d299db43f55867c38fea4454e3d35cf00d941e53c2bc257d6"
@@ -6155,7 +6155,7 @@
6155
  }
6156
  ],
6157
  "return": 0,
6158
- "stop": 5863,
6159
  "trace": null,
6160
  "trace_length": 170,
6161
  "trace_sha256": "c40ca3a5fcb0f8093118b59692131aee7d92d92b9274f3080c5360e514c3240e"
@@ -6206,7 +6206,7 @@
6206
  }
6207
  ],
6208
  "return": 0,
6209
- "stop": 5863,
6210
  "trace": null,
6211
  "trace_length": 170,
6212
  "trace_sha256": "c40ca3a5fcb0f8093118b59692131aee7d92d92b9274f3080c5360e514c3240e"
 
38
  }
39
  ],
40
  "return": 0,
41
+ "stop": 5862,
42
  "trace": null,
43
  "trace_length": 148,
44
  "trace_sha256": "c5b2803dbb723e8356d9da5bf5cb254182ca933da66ea24548acd05d34d2cb22"
 
861
  }
862
  ],
863
  "return": 0,
864
+ "stop": 5862,
865
  "trace": null,
866
  "trace_length": 170,
867
  "trace_sha256": "e9bb717ea6416341ee124c4483bd2dc6b96f05b4257882ae02e768e76d824ce9"
 
2476
  }
2477
  ],
2478
  "return": 0,
2479
+ "stop": 5862,
2480
  "trace": null,
2481
  "trace_length": 170,
2482
  "trace_sha256": "c40ca3a5fcb0f8093118b59692131aee7d92d92b9274f3080c5360e514c3240e"
 
3299
  }
3300
  ],
3301
  "return": 0,
3302
+ "stop": 5862,
3303
  "trace": null,
3304
  "trace_length": 148,
3305
  "trace_sha256": "c5b2803dbb723e8356d9da5bf5cb254182ca933da66ea24548acd05d34d2cb22"
 
3480
  }
3481
  ],
3482
  "return": 0,
3483
+ "stop": 5862,
3484
  "trace": null,
3485
  "trace_length": 148,
3486
  "trace_sha256": "c5b2803dbb723e8356d9da5bf5cb254182ca933da66ea24548acd05d34d2cb22"
 
3661
  }
3662
  ],
3663
  "return": 0,
3664
+ "stop": 5862,
3665
  "trace": null,
3666
  "trace_length": 148,
3667
  "trace_sha256": "c5b2803dbb723e8356d9da5bf5cb254182ca933da66ea24548acd05d34d2cb22"
 
3842
  }
3843
  ],
3844
  "return": 0,
3845
+ "stop": 5862,
3846
  "trace": null,
3847
  "trace_length": 148,
3848
  "trace_sha256": "c5b2803dbb723e8356d9da5bf5cb254182ca933da66ea24548acd05d34d2cb22"
 
3903
  }
3904
  ],
3905
  "return": 0,
3906
+ "stop": 5862,
3907
  "trace": null,
3908
  "trace_length": 170,
3909
  "trace_sha256": "e9bb717ea6416341ee124c4483bd2dc6b96f05b4257882ae02e768e76d824ce9"
 
4084
  }
4085
  ],
4086
  "return": 0,
4087
+ "stop": 5862,
4088
  "trace": null,
4089
  "trace_length": 170,
4090
  "trace_sha256": "e9bb717ea6416341ee124c4483bd2dc6b96f05b4257882ae02e768e76d824ce9"
 
4265
  }
4266
  ],
4267
  "return": 0,
4268
+ "stop": 5862,
4269
  "trace": null,
4270
  "trace_length": 170,
4271
  "trace_sha256": "e9bb717ea6416341ee124c4483bd2dc6b96f05b4257882ae02e768e76d824ce9"
 
4446
  }
4447
  ],
4448
  "return": 0,
4449
+ "stop": 5862,
4450
  "trace": null,
4451
  "trace_length": 170,
4452
  "trace_sha256": "e9bb717ea6416341ee124c4483bd2dc6b96f05b4257882ae02e768e76d824ce9"
 
4987
  }
4988
  ],
4989
  "return": 0,
4990
+ "stop": 5862,
4991
  "trace": null,
4992
  "trace_length": 170,
4993
  "trace_sha256": "c40ca3a5fcb0f8093118b59692131aee7d92d92b9274f3080c5360e514c3240e"
 
5168
  }
5169
  ],
5170
  "return": 0,
5171
+ "stop": 5862,
5172
  "trace": null,
5173
  "trace_length": 170,
5174
  "trace_sha256": "c40ca3a5fcb0f8093118b59692131aee7d92d92b9274f3080c5360e514c3240e"
 
5349
  }
5350
  ],
5351
  "return": 0,
5352
+ "stop": 5862,
5353
  "trace": null,
5354
  "trace_length": 170,
5355
  "trace_sha256": "c40ca3a5fcb0f8093118b59692131aee7d92d92b9274f3080c5360e514c3240e"
 
5530
  }
5531
  ],
5532
  "return": 0,
5533
+ "stop": 5862,
5534
  "trace": null,
5535
  "trace_length": 170,
5536
  "trace_sha256": "c40ca3a5fcb0f8093118b59692131aee7d92d92b9274f3080c5360e514c3240e"
 
5671
  }
5672
  ],
5673
  "return": 0,
5674
+ "stop": 5862,
5675
  "trace": null,
5676
  "trace_length": 148,
5677
  "trace_sha256": "c5b2803dbb723e8356d9da5bf5cb254182ca933da66ea24548acd05d34d2cb22"
 
5722
  }
5723
  ],
5724
  "return": 0,
5725
+ "stop": 5862,
5726
  "trace": null,
5727
  "trace_length": 148,
5728
  "trace_sha256": "c5b2803dbb723e8356d9da5bf5cb254182ca933da66ea24548acd05d34d2cb22"
 
5853
  }
5854
  ],
5855
  "return": 1,
5856
+ "stop": 5858,
5857
  "trace": null,
5858
  "trace_length": 170,
5859
  "trace_sha256": "e8e910b1529f5d1a4d60d2df1a15d9022601021a4fefdebd1ad49edb547b659f"
 
5904
  }
5905
  ],
5906
  "return": -1,
5907
+ "stop": 5843,
5908
  "trace": null,
5909
  "trace_length": 159,
5910
  "trace_sha256": "fa43856637143c0d299db43f55867c38fea4454e3d35cf00d941e53c2bc257d6"
 
6155
  }
6156
  ],
6157
  "return": 0,
6158
+ "stop": 5862,
6159
  "trace": null,
6160
  "trace_length": 170,
6161
  "trace_sha256": "c40ca3a5fcb0f8093118b59692131aee7d92d92b9274f3080c5360e514c3240e"
 
6206
  }
6207
  ],
6208
  "return": 0,
6209
+ "stop": 5862,
6210
  "trace": null,
6211
  "trace_length": 170,
6212
  "trace_sha256": "c40ca3a5fcb0f8093118b59692131aee7d92d92b9274f3080c5360e514c3240e"
docs/research/qvm-rank-partition-helpers.json ADDED
The diff for this file is too large to render. See raw diff
 
docs/research/qvm-ranking-complete.json CHANGED
@@ -6738,7 +6738,7 @@
6738
  }
6739
  ],
6740
  "return": 0,
6741
- "stop": 5863,
6742
  "trace": null,
6743
  "trace_length": 148,
6744
  "trace_sha256": "c5b2803dbb723e8356d9da5bf5cb254182ca933da66ea24548acd05d34d2cb22"
@@ -6809,7 +6809,7 @@
6809
  }
6810
  ],
6811
  "return": 0,
6812
- "stop": 5863,
6813
  "trace": null,
6814
  "trace_length": 148,
6815
  "trace_sha256": "c5b2803dbb723e8356d9da5bf5cb254182ca933da66ea24548acd05d34d2cb22"
@@ -6860,7 +6860,7 @@
6860
  }
6861
  ],
6862
  "return": 0,
6863
- "stop": 5863,
6864
  "trace": null,
6865
  "trace_length": 148,
6866
  "trace_sha256": "c5b2803dbb723e8356d9da5bf5cb254182ca933da66ea24548acd05d34d2cb22"
@@ -7264,7 +7264,7 @@
7264
  }
7265
  ],
7266
  "return": 0,
7267
- "stop": 5863,
7268
  "trace": null,
7269
  "trace_length": 148,
7270
  "trace_sha256": "c5b2803dbb723e8356d9da5bf5cb254182ca933da66ea24548acd05d34d2cb22"
@@ -7335,7 +7335,7 @@
7335
  }
7336
  ],
7337
  "return": 0,
7338
- "stop": 5863,
7339
  "trace": null,
7340
  "trace_length": 148,
7341
  "trace_sha256": "c5b2803dbb723e8356d9da5bf5cb254182ca933da66ea24548acd05d34d2cb22"
@@ -7386,7 +7386,7 @@
7386
  }
7387
  ],
7388
  "return": 0,
7389
- "stop": 5863,
7390
  "trace": null,
7391
  "trace_length": 148,
7392
  "trace_sha256": "c5b2803dbb723e8356d9da5bf5cb254182ca933da66ea24548acd05d34d2cb22"
@@ -8402,7 +8402,7 @@
8402
  }
8403
  ],
8404
  "return": 0,
8405
- "stop": 5863,
8406
  "trace": null,
8407
  "trace_length": 170,
8408
  "trace_sha256": "e9bb717ea6416341ee124c4483bd2dc6b96f05b4257882ae02e768e76d824ce9"
@@ -8473,7 +8473,7 @@
8473
  }
8474
  ],
8475
  "return": 0,
8476
- "stop": 5863,
8477
  "trace": null,
8478
  "trace_length": 170,
8479
  "trace_sha256": "e9bb717ea6416341ee124c4483bd2dc6b96f05b4257882ae02e768e76d824ce9"
@@ -8524,7 +8524,7 @@
8524
  }
8525
  ],
8526
  "return": 0,
8527
- "stop": 5863,
8528
  "trace": null,
8529
  "trace_length": 170,
8530
  "trace_sha256": "e9bb717ea6416341ee124c4483bd2dc6b96f05b4257882ae02e768e76d824ce9"
@@ -8928,7 +8928,7 @@
8928
  }
8929
  ],
8930
  "return": 0,
8931
- "stop": 5863,
8932
  "trace": null,
8933
  "trace_length": 170,
8934
  "trace_sha256": "e9bb717ea6416341ee124c4483bd2dc6b96f05b4257882ae02e768e76d824ce9"
@@ -8999,7 +8999,7 @@
8999
  }
9000
  ],
9001
  "return": 0,
9002
- "stop": 5863,
9003
  "trace": null,
9004
  "trace_length": 170,
9005
  "trace_sha256": "e9bb717ea6416341ee124c4483bd2dc6b96f05b4257882ae02e768e76d824ce9"
@@ -9050,7 +9050,7 @@
9050
  }
9051
  ],
9052
  "return": 0,
9053
- "stop": 5863,
9054
  "trace": null,
9055
  "trace_length": 170,
9056
  "trace_sha256": "e9bb717ea6416341ee124c4483bd2dc6b96f05b4257882ae02e768e76d824ce9"
@@ -11488,7 +11488,7 @@
11488
  }
11489
  ],
11490
  "return": 0,
11491
- "stop": 5863,
11492
  "trace": null,
11493
  "trace_length": 170,
11494
  "trace_sha256": "c40ca3a5fcb0f8093118b59692131aee7d92d92b9274f3080c5360e514c3240e"
@@ -11559,7 +11559,7 @@
11559
  }
11560
  ],
11561
  "return": 0,
11562
- "stop": 5863,
11563
  "trace": null,
11564
  "trace_length": 170,
11565
  "trace_sha256": "c40ca3a5fcb0f8093118b59692131aee7d92d92b9274f3080c5360e514c3240e"
@@ -11610,7 +11610,7 @@
11610
  }
11611
  ],
11612
  "return": 0,
11613
- "stop": 5863,
11614
  "trace": null,
11615
  "trace_length": 170,
11616
  "trace_sha256": "c40ca3a5fcb0f8093118b59692131aee7d92d92b9274f3080c5360e514c3240e"
@@ -12014,7 +12014,7 @@
12014
  }
12015
  ],
12016
  "return": 0,
12017
- "stop": 5863,
12018
  "trace": null,
12019
  "trace_length": 170,
12020
  "trace_sha256": "c40ca3a5fcb0f8093118b59692131aee7d92d92b9274f3080c5360e514c3240e"
@@ -12085,7 +12085,7 @@
12085
  }
12086
  ],
12087
  "return": 0,
12088
- "stop": 5863,
12089
  "trace": null,
12090
  "trace_length": 170,
12091
  "trace_sha256": "c40ca3a5fcb0f8093118b59692131aee7d92d92b9274f3080c5360e514c3240e"
@@ -12136,7 +12136,7 @@
12136
  }
12137
  ],
12138
  "return": 0,
12139
- "stop": 5863,
12140
  "trace": null,
12141
  "trace_length": 170,
12142
  "trace_sha256": "c40ca3a5fcb0f8093118b59692131aee7d92d92b9274f3080c5360e514c3240e"
 
6738
  }
6739
  ],
6740
  "return": 0,
6741
+ "stop": 5862,
6742
  "trace": null,
6743
  "trace_length": 148,
6744
  "trace_sha256": "c5b2803dbb723e8356d9da5bf5cb254182ca933da66ea24548acd05d34d2cb22"
 
6809
  }
6810
  ],
6811
  "return": 0,
6812
+ "stop": 5862,
6813
  "trace": null,
6814
  "trace_length": 148,
6815
  "trace_sha256": "c5b2803dbb723e8356d9da5bf5cb254182ca933da66ea24548acd05d34d2cb22"
 
6860
  }
6861
  ],
6862
  "return": 0,
6863
+ "stop": 5862,
6864
  "trace": null,
6865
  "trace_length": 148,
6866
  "trace_sha256": "c5b2803dbb723e8356d9da5bf5cb254182ca933da66ea24548acd05d34d2cb22"
 
7264
  }
7265
  ],
7266
  "return": 0,
7267
+ "stop": 5862,
7268
  "trace": null,
7269
  "trace_length": 148,
7270
  "trace_sha256": "c5b2803dbb723e8356d9da5bf5cb254182ca933da66ea24548acd05d34d2cb22"
 
7335
  }
7336
  ],
7337
  "return": 0,
7338
+ "stop": 5862,
7339
  "trace": null,
7340
  "trace_length": 148,
7341
  "trace_sha256": "c5b2803dbb723e8356d9da5bf5cb254182ca933da66ea24548acd05d34d2cb22"
 
7386
  }
7387
  ],
7388
  "return": 0,
7389
+ "stop": 5862,
7390
  "trace": null,
7391
  "trace_length": 148,
7392
  "trace_sha256": "c5b2803dbb723e8356d9da5bf5cb254182ca933da66ea24548acd05d34d2cb22"
 
8402
  }
8403
  ],
8404
  "return": 0,
8405
+ "stop": 5862,
8406
  "trace": null,
8407
  "trace_length": 170,
8408
  "trace_sha256": "e9bb717ea6416341ee124c4483bd2dc6b96f05b4257882ae02e768e76d824ce9"
 
8473
  }
8474
  ],
8475
  "return": 0,
8476
+ "stop": 5862,
8477
  "trace": null,
8478
  "trace_length": 170,
8479
  "trace_sha256": "e9bb717ea6416341ee124c4483bd2dc6b96f05b4257882ae02e768e76d824ce9"
 
8524
  }
8525
  ],
8526
  "return": 0,
8527
+ "stop": 5862,
8528
  "trace": null,
8529
  "trace_length": 170,
8530
  "trace_sha256": "e9bb717ea6416341ee124c4483bd2dc6b96f05b4257882ae02e768e76d824ce9"
 
8928
  }
8929
  ],
8930
  "return": 0,
8931
+ "stop": 5862,
8932
  "trace": null,
8933
  "trace_length": 170,
8934
  "trace_sha256": "e9bb717ea6416341ee124c4483bd2dc6b96f05b4257882ae02e768e76d824ce9"
 
8999
  }
9000
  ],
9001
  "return": 0,
9002
+ "stop": 5862,
9003
  "trace": null,
9004
  "trace_length": 170,
9005
  "trace_sha256": "e9bb717ea6416341ee124c4483bd2dc6b96f05b4257882ae02e768e76d824ce9"
 
9050
  }
9051
  ],
9052
  "return": 0,
9053
+ "stop": 5862,
9054
  "trace": null,
9055
  "trace_length": 170,
9056
  "trace_sha256": "e9bb717ea6416341ee124c4483bd2dc6b96f05b4257882ae02e768e76d824ce9"
 
11488
  }
11489
  ],
11490
  "return": 0,
11491
+ "stop": 5862,
11492
  "trace": null,
11493
  "trace_length": 170,
11494
  "trace_sha256": "c40ca3a5fcb0f8093118b59692131aee7d92d92b9274f3080c5360e514c3240e"
 
11559
  }
11560
  ],
11561
  "return": 0,
11562
+ "stop": 5862,
11563
  "trace": null,
11564
  "trace_length": 170,
11565
  "trace_sha256": "c40ca3a5fcb0f8093118b59692131aee7d92d92b9274f3080c5360e514c3240e"
 
11610
  }
11611
  ],
11612
  "return": 0,
11613
+ "stop": 5862,
11614
  "trace": null,
11615
  "trace_length": 170,
11616
  "trace_sha256": "c40ca3a5fcb0f8093118b59692131aee7d92d92b9274f3080c5360e514c3240e"
 
12014
  }
12015
  ],
12016
  "return": 0,
12017
+ "stop": 5862,
12018
  "trace": null,
12019
  "trace_length": 170,
12020
  "trace_sha256": "c40ca3a5fcb0f8093118b59692131aee7d92d92b9274f3080c5360e514c3240e"
 
12085
  }
12086
  ],
12087
  "return": 0,
12088
+ "stop": 5862,
12089
  "trace": null,
12090
  "trace_length": 170,
12091
  "trace_sha256": "c40ca3a5fcb0f8093118b59692131aee7d92d92b9274f3080c5360e514c3240e"
 
12136
  }
12137
  ],
12138
  "return": 0,
12139
+ "stop": 5862,
12140
  "trace": null,
12141
  "trace_length": 170,
12142
  "trace_sha256": "c40ca3a5fcb0f8093118b59692131aee7d92d92b9274f3080c5360e514c3240e"
docs/research/qvm-resumer-audit.json CHANGED
@@ -8416,7 +8416,78 @@
8416
  5863
8417
  ],
8418
  "path": "scripts/qvm_rank_compare_support.py",
8419
- "repeated_calls_opt_in": false
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8420
  },
8421
  {
8422
  "backward_conditional_branches": [
@@ -8918,9 +8989,9 @@
8918
  }
8919
  },
8920
  "summary": {
8921
- "call_expressions": 179,
8922
- "files": 140,
8923
- "legacy_expressions": 163,
8924
  "nonliteral_ranges": 20
8925
  }
8926
  }
 
8416
  5863
8417
  ],
8418
  "path": "scripts/qvm_rank_compare_support.py",
8419
+ "repeated_calls_opt_in": true
8420
+ },
8421
+ {
8422
+ "backward_conditional_branches": [
8423
+ 34897,
8424
+ 34961
8425
+ ],
8426
+ "calls": [],
8427
+ "explicit_result_offsets": null,
8428
+ "helper": "qvm_trace_support.resume",
8429
+ "line": 11,
8430
+ "literal_range": [
8431
+ 34830,
8432
+ 34962
8433
+ ],
8434
+ "path": "scripts/qvm_rank_partition_support.py",
8435
+ "repeated_calls_opt_in": true
8436
+ },
8437
+ {
8438
+ "backward_conditional_branches": [],
8439
+ "calls": [
8440
+ {
8441
+ "dynamic_store_requires_review": true,
8442
+ "implicit_local_offset": 76,
8443
+ "instruction": 34974,
8444
+ "stores_result": true,
8445
+ "target": "dynamic"
8446
+ },
8447
+ {
8448
+ "dynamic_store_requires_review": true,
8449
+ "implicit_local_offset": 76,
8450
+ "instruction": 34989,
8451
+ "stores_result": true,
8452
+ "target": "dynamic"
8453
+ },
8454
+ {
8455
+ "dynamic_store_requires_review": true,
8456
+ "implicit_local_offset": 76,
8457
+ "instruction": 35010,
8458
+ "stores_result": true,
8459
+ "target": "dynamic"
8460
+ },
8461
+ {
8462
+ "dynamic_store_requires_review": true,
8463
+ "implicit_local_offset": 76,
8464
+ "instruction": 35045,
8465
+ "stores_result": true,
8466
+ "target": "dynamic"
8467
+ },
8468
+ {
8469
+ "dynamic_store_requires_review": true,
8470
+ "implicit_local_offset": 76,
8471
+ "instruction": 35066,
8472
+ "stores_result": true,
8473
+ "target": "dynamic"
8474
+ }
8475
+ ],
8476
+ "explicit_result_offsets": {
8477
+ "34974": 36,
8478
+ "34989": 40,
8479
+ "35010": 44,
8480
+ "35045": 48,
8481
+ "35066": 52
8482
+ },
8483
+ "helper": "qvm_trace_support.resume",
8484
+ "line": 17,
8485
+ "literal_range": [
8486
+ 34965,
8487
+ 35093
8488
+ ],
8489
+ "path": "scripts/qvm_rank_partition_support.py",
8490
+ "repeated_calls_opt_in": true
8491
  },
8492
  {
8493
  "backward_conditional_branches": [
 
8989
  }
8990
  },
8991
  "summary": {
8992
+ "call_expressions": 181,
8993
+ "files": 141,
8994
+ "legacy_expressions": 162,
8995
  "nonliteral_ranges": 20
8996
  }
8997
  }
docs/research/rust-ranking.json CHANGED
@@ -6157,7 +6157,7 @@
6157
  }
6158
  ],
6159
  "source_reports": {
6160
- "docs/research/qvm-rank-comparator.json": "96eb5713165c2fd913536d4429394a3732776172f092a31b80f6d7b1e0fa0896",
6161
- "docs/research/qvm-ranking-complete.json": "0fda4571ff21629b034b915098c362f8c27a0e94fe3cf2988f35e5786f3508f4"
6162
  }
6163
  }
 
6157
  }
6158
  ],
6159
  "source_reports": {
6160
+ "docs/research/qvm-rank-comparator.json": "ed2f4208592fe2f7fe8865231b389fee6f155f35136cf4221bbd3b7c44ca2ec0",
6161
+ "docs/research/qvm-ranking-complete.json": "a640e560117e3e896182d9eea35c39c51e08d0d4741fb9c328df2820ffdcc5e6"
6162
  }
6163
  }
scripts/analyze_qvm_rank_partition_helpers.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Source word/block swaps and dynamic median-of-three ranking callbacks."""
3
+ import itertools
4
+ from pathlib import Path
5
+ from qvm_research_support import source
6
+ from qvm_rank_compare_support import seed,PTR
7
+ from qvm_rank_partition_support import swap,median
8
+ from analyze_qvm import write_json
9
+
10
+ def main():
11
+ q,raw,h,ins=source();swaps=[];medians=[]
12
+ initial=[(j*0x1234567+0x80000000)&0xffffffff for j in range(160)]
13
+ for kind,size,gap in itertools.product([0,1],[4,8,16,64,256],[0,1,80]):
14
+ m={PTR+4*j:v for j,v in enumerate(initial)};m.update({PTR-4:17,PTR+640:23});m,_,p=swap(ins,m,{8:PTR,12:PTR+4*gap,16:size,20:kind});swaps.append({'kind':kind,'bytes':size,'gap_words':gap,'initial':initial,'final':[m[PTR+4*j]&0xffffffff for j in range(160)],'guards':[m[PTR-4],m[PTR+640]],'execution':p['execution']})
15
+ for mode,ties,order in itertools.product([0,3,9,11],[False,True],itertools.permutations(range(3))):
16
+ clients=[{'248':(0 if ties else j),'280':0,'3032':0,'308':(0 if ties else j+1),'696':(0 if ties else j)} for j in range(3)];m=seed(mode,clients)
17
+ for j,v in enumerate(order):m[PTR+4*j]=v
18
+ m,result,p=median(ins,m,{8:PTR,12:PTR+4,16:PTR+8,20:5441});medians.append({'mode':mode,'ties':ties,'clients':clients,'order':list(order),'final_order':[m[PTR+4*j] for j in range(3)],'chosen_slot':(result-PTR)//4,'chosen_client':m[result],'callback_after':p['callback_after'],'execution':p['execution']})
19
+ write_json(Path('docs/research/qvm-rank-partition-helpers.json'),{'source':q['source'],'sha256':q['sha256'],'swaps':swaps,'medians':medians,'limits':'Actual34829 aligned word branch, positive4..256-byte lengths, including self/forward overlap; byte/unaligned branch excluded. Actual34964 with all five explicit dynamic return offsets and actual5441/33715. Complete helper bodies to return boundary; no whole sort/native/runtime parity yet.'})
20
+ if __name__=='__main__':main()
scripts/qvm_rank_compare_support.py CHANGED
@@ -15,4 +15,4 @@ def seed(mode,clients):
15
  return m
16
 
17
  def compare(ins,m,args):
18
- m[K+52]=args[8];m[K+56]=args[12];m,e=resume(ins,5442,5863,m,K,handlers={33715:predicate});return m,e['return'],e
 
15
  return m
16
 
17
  def compare(ins,m,args):
18
+ m[K+52]=args[8];m[K+56]=args[12];m,e=resume(ins,5442,5863,m,K,handlers={33715:predicate},repeated_calls=True);return m,e['return'],e
scripts/qvm_rank_partition_support.py ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Actual34829 aligned word swap and34964 median-of-three comparator helper."""
2
+ from qvm_health_effects_support import H
3
+ from qvm_rank_compare_support import compare
4
+ from qvm_trace_support import resume
5
+ SW=H+0x180000
6
+ MED=SW+0x1000
7
+
8
+ def swap(ins,m,args):
9
+ if args[8]%4 or args[12]%4 or args[16] not in range(4,257,4) or args[20] not in [0,1]:raise ValueError('unsupported aligned rank swap domain')
10
+ for o,v in args.items():m[SW+32+o]=v
11
+ m,e=resume(ins,34830,34962,m,SW,repeated_calls=True)
12
+ return m,0,{'arguments':args,'execution':e}
13
+
14
+ def median(ins,m,args):
15
+ if args[20]!=5441 or any(args[o]%4 for o in [8,12,16]):raise ValueError('unsupported rank median domain')
16
+ for o,v in args.items():m[MED+56+o]=v
17
+ m,e=resume(ins,34965,35093,m,MED,handlers={5441:compare},result_offsets={34974:36,34989:40,35010:44,35045:48,35066:52},repeated_calls=True)
18
+ return m,e['return'],{'arguments':args,'pointer':e['return'],'callback_after':m[MED+76],'execution':e}
scripts/test_qvm_rank_partition_helpers.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import functools,json,unittest
2
+ from pathlib import Path
3
+ from test_qvm_rank_comparator import compare
4
+ from qvm_rank_partition_support import swap,median
5
+ class PartitionHelperTests(unittest.TestCase):
6
+ @classmethod
7
+ def setUpClass(cls):cls.r=json.loads(Path('docs/research/qvm-rank-partition-helpers.json').read_text())
8
+ def test_sequential_word_swaps_overlap_self_and_guards(self):
9
+ self.assertEqual(len(self.r['swaps']),30)
10
+ for p in self.r['swaps']:
11
+ out=list(p['initial']);gap=p['gap_words']
12
+ for j in range(p['bytes']//4):out[j],out[gap+j]=out[gap+j],out[j]
13
+ self.assertEqual(p['final'],out);self.assertEqual(p['guards'],[17,23]);self.assertEqual(p['execution']['stop'],34962)
14
+ def test_median_value_pointer_callback_and_no_array_mutation(self):
15
+ self.assertEqual(len(self.r['medians']),48)
16
+ for p in self.r['medians']:
17
+ cmp=lambda a,b:compare(p['mode'],p['clients'][a],p['clients'][b]);middle=sorted(p['order'],key=functools.cmp_to_key(cmp))[1];self.assertEqual(cmp(p['chosen_client'],middle),0);self.assertIn(p['chosen_slot'],range(3));self.assertEqual(p['chosen_client'],p['order'][p['chosen_slot']]);self.assertEqual(p['final_order'],p['order']);self.assertEqual(p['callback_after'],5441);self.assertTrue(all(c['target']==5441 for c in p['execution']['calls']))
18
+ def test_unsupported_domains_fail_before_execution(self):
19
+ for args in [{8:4,12:8,16:0,20:0},{8:5,12:8,16:4,20:0},{8:4,12:8,16:4,20:2}]:
20
+ with self.assertRaisesRegex(ValueError,'unsupported aligned'):swap([],{},args)
21
+ with self.assertRaisesRegex(ValueError,'unsupported rank median'):median([],{},{8:4,12:8,16:12,20:17})
22
+ if __name__=='__main__':unittest.main()
xtask/checks.tsv CHANGED
@@ -1761,3 +1761,9 @@ report scripts/analyze_qvm_movement_reentry.py docs/research/qvm-movement-reentr
1761
  edge docs/research/qvm-movement-reentry.json scripts/test_qvm_movement_reentry.py
1762
  edge scripts/analyze_qvm_movement_reentry.py scripts/analyze_qvm_resumer_audit.py
1763
  group movement-reentry scripts/analyze_qvm_movement_reentry.py
 
 
 
 
 
 
 
1761
  edge docs/research/qvm-movement-reentry.json scripts/test_qvm_movement_reentry.py
1762
  edge scripts/analyze_qvm_movement_reentry.py scripts/analyze_qvm_resumer_audit.py
1763
  group movement-reentry scripts/analyze_qvm_movement_reentry.py
1764
+
1765
+ group rank-partition-helpers scripts/qvm_rank_compare_support.py
1766
+ report scripts/analyze_qvm_rank_partition_helpers.py docs/research/qvm-rank-partition-helpers.json
1767
+ edge docs/research/qvm-rank-partition-helpers.json scripts/test_qvm_rank_partition_helpers.py
1768
+ edge scripts/analyze_qvm_rank_partition_helpers.py scripts/analyze_qvm_resumer_audit.py
1769
+ group rank-partition-helpers scripts/analyze_qvm_rank_partition_helpers.py