Commit 7665886f authored by Andrey Filippov's avatar Andrey Filippov

CLAUDE: rung B - resident GPU pose-LMA decision AUTHORITATIVE in lmaStep

Design 3-A4i rung B (native tile_processor_gpu 5f47326): for the lean
three-angle shape the GPU decision drives the Java state machine:
- resident-valid production path: accept/stop from packed[23..24], RMS from
  packed[19..22] (floats widened exactly), parameters_vector from the
  resident candidate; NO Java candidate projection, NO re-decision, NO
  rejection-restore projection (GPU retained current state, device-side
  set-index commit). Decision equivalence was proven over 1,988 steps with
  zero mismatches (session-43 gate).
- invalid resident result (singular solve / non-finite) = REJECTED-STEP
  semantics: caller raises lambda and retries/exits; no Java-double fallback
  for the lean shape (fallbacks only where free). General shapes and the
  no-resident paths are unchanged.
- one-shot oracle preserved: at pose_lma_debug>=1 the first step falls
  through the legacy path once and prints the existing preparation/candidate/
  RMS-decision comparisons; production steps never compute the double side.
- marker updated: 'resident CUDA float LMA decision AUTHORITATIVE'.
Gates: mvn package PASS; mvn test PASS (no test sources); Stage0 33/33;
full native suite in tile_processor_gpu 5f47326.
Co-Authored-By: 's avatarClaude Fable 5 <noreply@anthropic.com>
parent 27e5139b
......@@ -1055,9 +1055,10 @@ public class CuasPoseRT {
numTiles, capturePrepared);
if ((result != null) && !pose_lma_step_path_reported) {
pose_lma_step_path_reported = true;
System.out.println("CuasPoseRT: resident CUDA float LMA decision/state oracle active "+
"(GPU candidate accept swaps raw buffers; reject retains current; "+
"Java acceptance authoritative)");
// Rung B (design 2026-07-16): GPU decision promoted to authoritative. By Claude on 07/16/2026.
System.out.println("CuasPoseRT: resident CUDA float LMA decision AUTHORITATIVE "+
"(GPU accept/stop/RMS drive the state machine; device-side set-index commit; "+
"reject retains GPU state; Java one-shot oracle at pose_lma_debug>=1)");
}
return result;
}); // production candidate: resident raw fx/J -> parallel prepare/reduce -> fixed 3x3 tail // By Codex on 07/15/2026
......
......@@ -974,6 +974,18 @@ public class IntersceneLma {
final boolean residentCandidateValid = (residentPoseStep != null) &&
residentPoseStep.valid &&
(residentPoseStep.candidate.length == parameters_vector.length);
// RUNG B (design 2026-07-16): with the resident machinery active, an invalid
// GPU result (singular solve / non-finite) is a REJECTED STEP - the caller
// raises lambda and retries or exits, exactly the LMA semantics of a singular
// H+lambda*diag. No Java-double fallback for the lean shape (fallbacks only
// where free); general shapes never enter this branch. By Claude on 07/16/2026.
final boolean residentMachineryActive = (poseLmaResidentStepProvider != null) &&
poseStepShape && (poseFloatLastResult != null) && (poseFloatLastResult.jt != null);
if (residentMachineryActive && !residentCandidateValid) {
System.out.println("IntersceneLma: resident pose LMA step invalid "+
"(singular solve / non-finite) - rejected-step semantics, lambda="+lambda);
return rslt; // {false, false}: not improved, caller decides
}
DoubleLmaStepResult doubleStep = null;
if (!residentCandidateValid || captureResidentOracle) {
doubleStep = calculateDoubleLmaStep(lambda, debug_level);
......@@ -1029,6 +1041,30 @@ public class IntersceneLma {
}
}
// RUNG B (design 2026-07-16): the resident GPU decision is AUTHORITATIVE for
// the lean shape. Accept/stop/RMS come from packed[19..24]; the production
// path projects NOTHING in Java - no candidate getFxDerivs, no re-decision,
// no rejection-restore projection (the GPU retained the current raw state by
// contract, device-side commit). The pre-existing decision equivalence was
// proven over 1,988 steps with zero mismatches (session-43 gate). The one-shot
// oracle (captureResidentOracle, pose_lma_debug>=1) falls through to the
// legacy path below ONCE per run to print the Java-double comparison.
// By Claude on 07/16/2026.
if (residentCandidateValid && !captureResidentOracle) {
final double candidateFullRms = residentResult.candidateRms; // float widened exactly
final double candidatePureRms = residentResult.candidatePureRms;
this.good_or_bad_rms = new double [] {candidateFullRms, candidatePureRms};
if (residentResult.accepted) {
rslt[0] = true;
rslt[1] = residentResult.stop;
this.last_rms = new double [] {candidateFullRms, candidatePureRms};
this.parameters_vector = new_vector.clone();
} else { // rejected: GPU kept the current set (no flip); nothing to restore here
rslt[0] = false;
rslt[1] = false;
}
return rslt;
}
double [] fx = getFxDerivs(
new_vector, // double [] vector,
last_jt, // final double [][] jt, // should be null or initialized with [vector.length][]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment