code wiki / _hdl_build / nx_ge_synth.nx

nx_ge_synth.nx source

↩ module page · 123 lines · 7342 B

1// nx_ge_synth.nx -- SOVEREIGN extractive-synthesis + corroboration + CONTRADICTION organ (v2: now with 2// contrarian sources in the corpus so contradiction-detection has material). The honest mechanical lever 3// to close the researcher's quality gap vs Claude deep-research. Per the pre-registered 10-point rubric 4// over the real fetched corpus (P1 render 8 + P3 mobile-perf 6 + CONTRARIAN 4 = 18 sources): 5// COVERAGE = #sources containing the concept (retrieval) 6// CORROBORATED = coverage >= 2 (>=2-source / no-hearsay rule) 7// EXPLAINED = a source states concept AND its MECHANISM in one ~400B passage (extractive synthesis) 8// CONTESTED = some source associates concept+CLAIM and some source associates concept+COUNTER 9// => the corpus holds CONFLICTING framings -> flag, do not naively admit. This is the 10// DETERMINISTIC + REPRODUCIBLE analog of deep-research's stochastic 3-vote refutation. 11// HONEST: extractive, not generative; cannot produce cross-source reasoning/caveats an LLM adds. Measured 12// here; judged vs the SAME rubric bar. 100% sovereign (nx_cc->nxasm). license_tier: ORIGINAL expect_exit:0 13import "nx_syscalls.nx" 14import "nx_research_extract.nx" 15 16func sw(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } 17func sn(v: i64) -> i64 { let bb: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m;sys_write(1,"-" as *u8,1)} let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=48 as u8;k=1} while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1} var i: i64=0; while i<k{bb[i]=t[k-1-i];i=i+1} sys_write(1,bb,k); return 0 } 18 19func load(idx: i64, path: *u8, bufs: *i64, lens: *i64) -> i64 { 20 let tl: *i64 = sys_mmap(8) as *i64 21 tl[0] = 0 22 let p: *u8 = sys_read_file(path, tl) 23 if p == (0 as *u8) { bufs[idx] = 0; lens[idx] = 0; return 0 } 24 bufs[idx] = p as i64 25 lens[idx] = tl[0] 26 return 0 27} 28 29// out[0]=coverage(#files w/ concept) out[1]=explained(0/1) out[2]=contested(0/1) 30func score_point(concept: *u8, mech: *u8, claim: *u8, counter: *u8, bufs: *i64, lens: *i64, nf: i64, out: *i64) -> i64 { 31 var cov: i64 = 0 32 var expl: i64 = 0 33 var has_claim: i64 = 0 34 var has_counter: i64 = 0 35 let WIN: i64 = 400 36 var i: i64 = 0 37 while i < nf { 38 let n: i64 = lens[i] 39 if n > 0 { 40 let t: *u8 = (bufs[i]) as *u8 41 let cp: i64 = re_find(t, n, concept) 42 if cp >= 0 { 43 cov = cov + 1 44 var wlen: i64 = n - cp 45 if wlen > WIN { wlen = WIN } 46 let base: *u8 = ((t as i64) + cp) as *u8 47 if re_find(base, wlen, mech) >= 0 { expl = 1 } 48 if re_strlen(claim) > 0 { if re_find(t, n, claim) >= 0 { has_claim = 1 } } 49 if re_strlen(counter) > 0 { if re_find(t, n, counter) >= 0 { has_counter = 1 } } 50 } 51 } 52 i = i + 1 53 } 54 out[0] = cov 55 out[1] = expl 56 var contested: i64 = 0 57 if has_claim == 1 { if has_counter == 1 { contested = 1 } } 58 out[2] = contested 59 return 0 60} 61 62func report(id: *u8, concept: *u8, mech: *u8, claim: *u8, counter: *u8, bufs: *i64, lens: *i64, nf: i64, tot: *i64) -> i64 { 63 let out: *i64 = sys_mmap(32) as *i64 64 score_point(concept, mech, claim, counter, bufs, lens, nf, out) 65 sw(" "); sw(id); sw(" cov="); sn(out[0]) 66 sw(" corrob="); if out[0] >= 2 { sw("Y"); tot[1] = tot[1] + 1 } else { sw("n") } 67 sw(" explained="); if out[1] == 1 { sw("Y"); tot[2] = tot[2] + 1 } else { sw("n") } 68 sw(" CONTESTED="); if out[2] == 1 { sw("Y"); tot[3] = tot[3] + 1 } else { sw("n") } 69 sw("\n") 70 if out[0] >= 1 { tot[0] = tot[0] + 1 } 71 return 0 72} 73 74func main() -> i64 { 75 let bufs: *i64 = sys_mmap(8 * 24) as *i64 76 let lens: *i64 = sys_mmap(8 * 24) as *i64 77 load(0, "knowledge/fetched/ge_p1_graphics_pipeline.raw" as *u8, bufs, lens) 78 load(1, "knowledge/fetched/ge_p1_software_rendering.raw" as *u8, bufs, lens) 79 load(2, "knowledge/fetched/ge_p1_rasterisation.raw" as *u8, bufs, lens) 80 load(3, "knowledge/fetched/ge_p1_raytracing.raw" as *u8, bufs, lens) 81 load(4, "knowledge/fetched/ge_p1_vulkan.raw" as *u8, bufs, lens) 82 load(5, "knowledge/fetched/ge_p1_directx.raw" as *u8, bufs, lens) 83 load(6, "knowledge/fetched/ge_p1_spirv.raw" as *u8, bufs, lens) 84 load(7, "knowledge/fetched/ge_p1_tilebased.raw" as *u8, bufs, lens) 85 load(8, "knowledge/fetched/ge_p3_framerate.raw" as *u8, bufs, lens) 86 load(9, "knowledge/fetched/ge_p3_inputlag.raw" as *u8, bufs, lens) 87 load(10, "knowledge/fetched/ge_p3_lod.raw" as *u8, bufs, lens) 88 load(11, "knowledge/fetched/ge_p3_ecs.raw" as *u8, bufs, lens) 89 load(12, "knowledge/fetched/ge_p3_dod.raw" as *u8, bufs, lens) 90 load(13, "knowledge/fetched/ge_p3_gameprogramming.raw" as *u8, bufs, lens) 91 load(14, "knowledge/fetched/ge_c_hardware_accel.raw" as *u8, bufs, lens) 92 load(15, "knowledge/fetched/ge_c_gpu.raw" as *u8, bufs, lens) 93 load(16, "knowledge/fetched/ge_c_larrabee.raw" as *u8, bufs, lens) 94 load(17, "knowledge/fetched/ge_c_gpgpu.raw" as *u8, bufs, lens) 95 let nf: i64 = 18 96 97 var loaded: i64 = 0 98 var i: i64 = 0 99 while i < nf { if lens[i] > 0 { loaded = loaded + 1 } i = i + 1 } 100 sw("corpus loaded="); sn(loaded); sw("/"); sn(nf); sw(" (14 topical + 4 contrarian)\n") 101 102 let tot: *i64 = sys_mmap(64) as *i64 103 tot[0]=0; tot[1]=0; tot[2]=0; tot[3]=0 // covered, corroborated, explained, CONTESTED 104 105 sw("=== SOVEREIGN extract+corroborate+CONTRADICTION over rubric ===\n") 106 report("R1 tbdr-bandwidth " as *u8, "tile-based" as *u8, "bandwidth" as *u8, "" as *u8, "" as *u8, bufs, lens, nf, tot) 107 report("R2 bandwidth-power " as *u8, "bandwidth" as *u8, "power" as *u8, "" as *u8, "" as *u8, bufs, lens, nf, tot) 108 report("R3 spirv-portable " as *u8, "SPIR-V" as *u8, "portable" as *u8, "portable" as *u8, "vendor" as *u8, bufs, lens, nf, tot) 109 report("R4 open-driver " as *u8, "Mesa" as *u8, "driver" as *u8, "" as *u8, "" as *u8, bufs, lens, nf, tot) 110 report("R5 sw-raster-cpu " as *u8, "software rasteri" as *u8, "CPU" as *u8, "real-time" as *u8, "slower" as *u8, bufs, lens, nf, tot) 111 report("R6 culling-occlusion" as *u8, "culling" as *u8, "occlusion" as *u8, "" as *u8, "" as *u8, bufs, lens, nf, tot) 112 report("R7 fixedpoint-prec " as *u8, "fixed-point" as *u8, "precision" as *u8, "" as *u8, "" as *u8, bufs, lens, nf, tot) 113 report("R8 dataoriented-cche" as *u8, "data-oriented" as *u8, "cache" as *u8, "" as *u8, "" as *u8, bufs, lens, nf, tot) 114 report("R9 sw-vs-hw-limit " as *u8, "rasteriz" as *u8, "hardware" as *u8, "ballpark" as *u8, "never" as *u8, bufs, lens, nf, tot) 115 report("R10 compute-shader " as *u8, "compute shader" as *u8, "shader" as *u8, "" as *u8, "" as *u8, bufs, lens, nf, tot) 116 117 sw("--- TOTALS (of 10) ---\n") 118 sw(" covered_pts = "); sn(tot[0]); sw("\n") 119 sw(" corroborated_pts= "); sn(tot[1]); sw(" (>=2 sources)\n") 120 sw(" EXPLAINED_pts = "); sn(tot[2]); sw(" <- sovereign EXTRACTIVE synthesis (honest: not generative reasoning)\n") 121 sw(" CONTESTED_pts = "); sn(tot[3]); sw(" <- REPRODUCIBLE contradiction-detection (deterministic; deep-research's 3-vote is stochastic)\n") 122 return 0 123}