Commit f6dcc90f authored by Andrey Filippov's avatar Andrey Filippov

CLAUDE: JNA getCorrIndices propagates num_corr_tiles to base field (real fix)

Root cause of the CORR2D-all-NaN / 0-targets: the inter-correlation actually
works (probe showed num_corr_tiles=8850 = 4425 tiles x (1 sensor + 1 sum)), but
the TD readback dropped it. Base GpuQuad.getCorrIndices() sets the num_corr_tiles
field ("also sets num_corr_tiles"); GpuQuadJna.getCorrIndices() read the native
count locally and returned the array WITHOUT setting the field. So
TDCorrTile.getFromGpu (num_tiles = getNumCorrTiles()/num_pairs) and base
getCorrTilesTd (uses the field directly) saw a stale 0 -> built 0 tiles ->
empty target sequence -> null ROUND_ONE image -> saveImagePlusInModelDirectory
NPE (the misplaced-null-guard latent bug is just the messenger).

Fix: GpuQuadJna.getCorrIndices() sets num_corr_tiles = n (native count); field
made protected so the subclass can. Java-only.
Co-Authored-By: 's avatarClaude Opus 4.8 (1M context) <noreply@anthropic.com>
parent c592e5ff
......@@ -141,7 +141,7 @@ public class GpuQuad{ // quad camera description
private int texture_stride;
private int texture_stride_rgba;
public int num_task_tiles;
private int num_corr_tiles;
protected int num_corr_tiles; // protected so the JNA backend can propagate the native count (getFromGpu/getCorrTilesTd read it). By Claude 06/26/2026.
private final int num_all_pairs; // = 6; // number of correlation pairs per tile (should match tasks)
private int num_corr_combo_tiles;
private int num_texture_tiles;
......
......@@ -358,6 +358,8 @@ public class GpuQuadJna extends GpuQuad {
// ---- oracle TD-correlation readback / erase (read gpu_corr_indices / gpu_corrs_td / combo_indices) ----
@Override public int[] getCorrIndices() {
int n = lib.tp_proc_num_corr_tiles(proc);
num_corr_tiles = n; // propagate the native count to the base field (base getCorrIndices does this too;
// getFromGpu/getCorrTilesTd read num_corr_tiles -> without this they see 0). By Claude 06/26/2026.
int[] out = new int[n];
lib.tp_proc_get_corr_indices(proc, out, n);
return out;
......
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