Optics: add bounded HIP PSF replay and tile reduction experiments

Capture prepared events through a test-only producer consumer and measure serial and indexed parallel generation independently. Compare the production atomic kernel with bounded pixel-owned tile reductions while preserving double HDR, cache support, and direct fallback ordering.

Validate captured inputs, edge and multichunk fixtures, CPU/HIP renderer regressions, and 45 isolated final replays. Keep the production HIP algorithm unchanged because gains depend on event distribution.
This commit is contained in:
wyj committed 2026-09-11 16:43:53 -04:00
1 parent 5eccc31c99
commit 7f5ec1a488
6 files changed
+501

No files matched your search

+19
View File
@@ -1114,6 +1114,19 @@ static int splat_catalog_tile(const Star *stars, size_t count,
const int direct_fallback = psf_prepare_cached_event(
&event, image_x, image_y, color, flux, context->psf, context->psf_cache,
context->max_cache_psf_flux, context->psf_relative_tail, context->psf_min_y);
#ifdef FRAME_PSF_DIAGNOSTIC
/* Test-only consumer: normal query/mapping/colour/classification above.
* Never produces an HDR image; not compiled into renderer binaries. */
if (frame_psf_diagnostic_visit(&event, direct_fallback,
context->triangle_index, image_x, image_y,
color, flux))
return -1;
context->direct_fallbacks += direct_fallback == 1;
context->cached_wing_clipped += direct_fallback == 2;
context->discarded_below_min_y += direct_fallback == 3;
++context->images;
continue;
#endif
if (direct_fallback == 1) {
/* Exclude every other submit and fallback until HDR is back on device. */
#ifdef PSF_BACKEND_HIP
@@ -1180,6 +1193,9 @@ static CatalogSplatStats splat_catalog_triangles(
event_sink = &owned_sink;
}
for (size_t t = first_triangle; t < last_triangle; ++t) {
#ifdef FRAME_PSF_DIAGNOSTIC
if (frame_psf_diagnostic_stopped()) break;
#endif
const LensVertex *vertex[3];
if (!usable_triangle(mesh, &mesh->triangles[t], vertex))
continue;
@@ -1189,6 +1205,9 @@ static CatalogSplatStats splat_catalog_triangles(
spherical_area(vertex[0]->camera_direction, vertex[1]->camera_direction,
vertex[2]->camera_direction);
const double raw_magnification = image_area / source_area;
#ifdef FRAME_PSF_DIAGNOSTIC
if (!frame_psf_diagnostic_select(raw_magnification)) continue;
#endif
double magnification = raw_magnification;
#ifdef GR_DEBUG
stats.max_raw_magnification = fmax(stats.max_raw_magnification,