nmarshall commited on
Commit
22e336d
·
1 Parent(s): 071f6b7

qvm: complete bounded aim function

Browse files
docs/ASSET_PIPELINE_TODO.md CHANGED
@@ -532,3 +532,6 @@ Research progress: RE-616 [report](research/QVM_AIM_EXTRA_OFFSETS.md); remaining
532
 
533
 
534
  Research progress: RE-617 [report](research/QVM_AIM_ENDPOINT.md); remaining native/content/runtime/platform scope stays open.
 
 
 
 
532
 
533
 
534
  Research progress: RE-617 [report](research/QVM_AIM_ENDPOINT.md); remaining native/content/runtime/platform scope stays open.
535
+
536
+
537
+ Research progress: RE-618 [report](research/QVM_COMPLETE_AIM.md); remaining native/content/runtime/platform scope stays open.
docs/FINDINGS.md CHANGED
@@ -887,3 +887,6 @@ Bounded qagame paths recover bomb-plant/inactivity correction requests, direct f
887
 
888
 
889
  **RE-617 — Aim endpoint construction and selected alias behavior:** The endpoint adds origin+16384×forward, then horizontal×global right and vertical×global up in distinct f32 write phases. [Evidence](research/QVM_AIM_ENDPOINT.md).
 
 
 
 
887
 
888
 
889
  **RE-617 — Aim endpoint construction and selected alias behavior:** The endpoint adds origin+16384×forward, then horizontal×global right and vertical×global up in distinct f32 write phases. [Evidence](research/QVM_AIM_ENDPOINT.md).
890
+
891
+
892
+ **RE-618 — Complete bounded shared aim function control flow:** A single bounded source interpreter now follows every branch and call through290493, including rejection loops, added jitter and final endpoint writes. [Evidence](research/QVM_COMPLETE_AIM.md).
docs/PROVISIONAL_TODO.md CHANGED
@@ -852,3 +852,6 @@ Research progress: RE-616 [report](research/QVM_AIM_EXTRA_OFFSETS.md); remaining
852
 
853
 
854
  Research progress: RE-617 [report](research/QVM_AIM_ENDPOINT.md); remaining native/content/runtime/platform scope stays open.
 
 
 
 
852
 
853
 
854
  Research progress: RE-617 [report](research/QVM_AIM_ENDPOINT.md); remaining native/content/runtime/platform scope stays open.
855
+
856
+
857
+ Research progress: RE-618 [report](research/QVM_COMPLETE_AIM.md); remaining native/content/runtime/platform scope stays open.
docs/RESEARCH_LEDGER.md CHANGED
@@ -767,3 +767,8 @@ IDs10/14/23 may add two RNG offsets; flag84 and the strict150-time boundary cont
767
  ## 2026-10-20 — RE-617 Aim endpoint construction and selected alias behavior (separate task commit)
768
 
769
  The endpoint adds origin+16384×forward, then horizontal×global right and vertical×global up in distinct f32 write phases. 27 independent endpoint fixtures cover nonunit vectors and output aliases to origin/forward, retaining actual source effects. Full suite: 961 tests pass. Report regenerates byte-identically (417024 bytes). Storage/filter, links and whitespace checks pass. No assets/Rust runtime/shared VM evaluator changed; native/reference/legal/full platform scope remains open.
 
 
 
 
 
 
767
  ## 2026-10-20 — RE-617 Aim endpoint construction and selected alias behavior (separate task commit)
768
 
769
  The endpoint adds origin+16384×forward, then horizontal×global right and vertical×global up in distinct f32 write phases. 27 independent endpoint fixtures cover nonunit vectors and output aliases to origin/forward, retaining actual source effects. Full suite: 961 tests pass. Report regenerates byte-identically (417024 bytes). Storage/filter, links and whitespace checks pass. No assets/Rust runtime/shared VM evaluator changed; native/reference/legal/full platform scope remains open.
770
+
771
+
772
+ ## 2026-10-20 — RE-618 Complete bounded shared aim function control flow (separate task commit)
773
+
774
+ A single bounded source interpreter now follows every branch and call through290493, including rejection loops, added jitter and final endpoint writes. 17 whole-function fixtures agree with independently checked staged calculations and endpoint formulas; zero seed stops at32 candidates with untouched output. Full suite: 965 tests pass. Report regenerates byte-identically (210344 bytes). Storage/filter, links and whitespace checks pass. No assets/Rust runtime/shared VM evaluator changed; native/reference/legal/full platform scope remains open.
docs/REVERSE_ENGINEERING_TODO.md CHANGED
@@ -895,3 +895,6 @@ Purpose: turn the supplied installation into an evidence-backed specification of
895
 
896
 
897
  - [x] RE-617 Aim endpoint construction and selected alias behavior ([report](research/QVM_AIM_ENDPOINT.md)).
 
 
 
 
895
 
896
 
897
  - [x] RE-617 Aim endpoint construction and selected alias behavior ([report](research/QVM_AIM_ENDPOINT.md)).
898
+
899
+
900
+ - [x] RE-618 Complete bounded shared aim function control flow ([report](research/QVM_COMPLETE_AIM.md)).
docs/research/QVM_COMPLETE_AIM.md ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ # Complete bounded shared aim function control flow
2
+
3
+ RE-618. Reproduce with `python3 scripts/analyze_qvm_complete_aim.py`; check with `python3 scripts/test_qvm_complete_aim.py`. The [machine report](qvm-complete-aim.json) retains source identity and bounded fixtures.
4
+
5
+ The new driver interprets290494–291638 as one source range, retaining jumps, native call order and actual36717 state across all stages. It explicitly dispatches only recovered RNG and finite math natives, patches source LOCAL result destinations and rejects unexpected children. Calls and source trace hashes remain visible. Sixteen ordinary cases agree with the previously independently validated staged chain; direct f32 endpoint checks provide an additional vector oracle. A zero-seed case records128 RNG calls plus one sqrt,32 rejected candidates, no trig and unchanged output. The32-attempt limit is a harness boundary, not a successful function return. Completion stops before the void epilogue, and establishes aim data flow rather than a hit/damage outcome.
6
+
7
+ No original executable/full QVM/native collision/physics/rendering executes. Native responses and legal input domains are supplied or unverified where stated; full runtime/macOS/Linux Rust/Bevy/Solari gameplay remains open.
docs/research/README.md CHANGED
@@ -453,3 +453,6 @@ The extension collector adds five focused tests for native tail calls, command-r
453
 
454
 
455
  [RE-617: Aim endpoint construction and selected alias behavior](QVM_AIM_ENDPOINT.md). Reproduce with `python3 scripts/analyze_qvm_aim_endpoint.py`; check with `python3 scripts/test_qvm_aim_endpoint.py`.
 
 
 
 
453
 
454
 
455
  [RE-617: Aim endpoint construction and selected alias behavior](QVM_AIM_ENDPOINT.md). Reproduce with `python3 scripts/analyze_qvm_aim_endpoint.py`; check with `python3 scripts/test_qvm_aim_endpoint.py`.
456
+
457
+
458
+ [RE-618: Complete bounded shared aim function control flow](QVM_COMPLETE_AIM.md). Reproduce with `python3 scripts/analyze_qvm_complete_aim.py`; check with `python3 scripts/test_qvm_complete_aim.py`.
docs/research/qvm-complete-aim.json ADDED
The diff for this file is too large to render. See raw diff
 
scripts/analyze_qvm_complete_aim.py ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Interpret the entire290493 body with source control flow and bounded sampling."""
3
+ import itertools,math
4
+ from pathlib import Path
5
+ from analyze_deferred_auth import trace_slice
6
+ from analyze_bsp_references import trace_fields
7
+ from qvm_research_support import source
8
+ from qvm_server_fire_support import seed,ENTITY,RIGHT,UP
9
+ from qvm_shot_math_support import TRIG
10
+ from analyze_qvm_server_shot_setup import random_word
11
+ from analyze_qvm_spread_parameters import LOCAL
12
+ from analyze_qvm_aim_endpoint import inputs,endpoint,ORIGIN,DIRECTION,OUTPUT
13
+ from analyze_qvm_acceleration import PS,word,number
14
+ from analyze_qvm_slide_prefix import vec
15
+ from analyze_qvm import write_json
16
+
17
+ def complete_aim(ins,m,origin=ORIGIN,direction=DIRECTION,output=OUTPUT,attempt_limit=32):
18
+ if not 1<=attempt_limit<=64:raise ValueError('Attempt limit outside1..64')
19
+ m=dict(m);initial={'origin':vec(m,origin),'forward':vec(m,direction),'right':vec(m,RIGHT),'up':vec(m,UP),'output':vec(m,output),'seed':m[21044]&0xffffffff};m.update({LOCAL+216:ENTITY,LOCAL+220:origin,LOCAL+224:direction,LOCAL+228:output});pc=290494;trace=[];calls=[];effects=[];candidates=[];points=[x['index']+2 for x in ins[290494:291639] if x['opcode']=='CALL']+[291079,291081,291639]
20
+ for _ in range(512):
21
+ t=trace_slice(ins,290494,291639,m,{},resume_at=pc,stop_targets=[p for p in points if p!=pc],local_base=LOCAL,capture_stack=True,limit=8192);m=t['memory'];trace+=t['trace'];pc=t['stop'];calls+=t['calls']
22
+ for c in t['calls']:
23
+ target=c['target']
24
+ if target==36717:m,e=random_word(ins,m);value=e['result'];effect={k:e[k] for k in ['initial_seed','final_seed','result']};effect['trace_sha256']=e['execution']['trace_sha256']
25
+ elif target==-107:value=word(math.sqrt(number(c['args'][8])));effect={'model':'sqrt','input':c['args'][8]&0xffffffff,'result':value}
26
+ elif target in TRIG:m,_,value,effect=TRIG[target](ins,m,c['args'],(0,0,0))
27
+ else:raise ValueError('Unrecovered aim child '+str(target))
28
+ assert ins[c['instruction']+1]['opcode']=='STORE4' and ins[c['instruction']-2]['opcode']=='LOCAL'
29
+ m[LOCAL+ins[c['instruction']-2]['operand']]=value;effects.append({'call':c,'effect':effect})
30
+ if 291066 in t['trace']:candidates.append({'x':m[LOCAL+28]&0xffffffff,'y':m[LOCAL+32]&0xffffffff,'radius_squared':m[LOCAL+128]&0xffffffff,'accepted':pc==291081})
31
+ if pc==291639:status='void-epilogue';break
32
+ if pc==291079 and len(candidates)>=attempt_limit:status='attempt-budget-exhausted';break
33
+ else:raise ValueError('Aim segment bound exceeded')
34
+ return m,{'initial':initial,'attempt_limit':attempt_limit,'candidates':candidates,'status':status,'execution':{'calls':calls,'children':effects,**trace_fields({'trace':trace},False)},'offsets':{str(o):m[LOCAL+o]&0xffffffff for o in [76,52]} if status=='void-epilogue' else None,'output':vec(m,output),'final_seed':m[21044]&0xffffffff}
35
+
36
+ def main():
37
+ q,raw,h,ins=source();rows=[]
38
+ for ident,rng,ground in itertools.product([2,10,14,23],[1,0x12345678],[0,1023]):
39
+ m=seed(raw,h,ident);m[PS+144]=0;m[PS+312]=ident;m[PS+68]=ground;m[PS+216]=10;m[21044]=rng;m=inputs(m,direction=(.6,-.25,.8));_,r=complete_aim(ins,m);_,stages=endpoint(ins,m);r['staged_comparison']={'output':stages['output'],'final_seed':stages['final_seed'],'status':stages['status']};rows.append(r)
40
+ m=inputs(seed(raw,h));m[21044]=0;rows.append(complete_aim(ins,m)[1])
41
+ write_json(Path('docs/research/qvm-complete-aim.json'),{'source':q['source'],'sha256':q['sha256'],'probes':rows,'limits':'Complete290494–291638 source control flow; stop before void epilogue. Actual36717, finite supplied math natives;32-candidate limit. No fabricated completion on budget exhaustion. No engine trace, hit or damage.'})
42
+ if __name__=='__main__':main()
scripts/test_qvm_complete_aim.py ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json,unittest
2
+ from pathlib import Path
3
+ from test_qvm_aim_endpoint import expected
4
+ class CompleteAimTests(unittest.TestCase):
5
+ @classmethod
6
+ def setUpClass(cls):cls.r=json.loads(Path('docs/research/qvm-complete-aim.json').read_text())
7
+ def test_independent_endpoint_and_staged_agreement(self):
8
+ self.assertEqual(len(self.r['probes']),17)
9
+ for p in self.r['probes'][:-1]:
10
+ self.assertEqual(p['output'],expected({'initial':p['initial'],'offsets_stage':{'offsets':p['offsets']}}));self.assertEqual({k:p[k] for k in ['output','final_seed','status']},p['staged_comparison'])
11
+ def test_four_rng_calls_per_candidate_plus_optional_pair(self):
12
+ for p in self.r['probes'][:-1]:
13
+ calls=[c for c in p['execution']['calls'] if c['target']==36717];self.assertIn(len(calls)-4*len(p['candidates']),[0,2]);self.assertTrue(p['candidates'][-1]['accepted']);self.assertFalse(any(c['accepted'] for c in p['candidates'][:-1]))
14
+ def test_zero_seed_no_output_or_trig(self):
15
+ p=self.r['probes'][-1];self.assertEqual(p['status'],'attempt-budget-exhausted');self.assertEqual(p['output'],p['initial']['output']);self.assertEqual(len(p['candidates']),32);self.assertEqual(len(p['execution']['calls']),129);self.assertFalse(any(c['target'] in [-104,-105] for c in p['execution']['calls']))
16
+ def test_unexpected_children_are_not_supplied(self):
17
+ for p in self.r['probes']:self.assertLessEqual(set(c['target'] for c in p['execution']['calls']),{36717,-107,-104,-105})
18
+ if __name__=='__main__':unittest.main()