Files
wyj 7f5ec1a488 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.
2026-09-11 16:43:53 -04:00

27 lines
1.3 KiB
C

/* Deliberately synthetic edge/phase/hotspot/wing fixture, not a benchmark
* substitute for captured catalog events. Output round-trips all doubles. */
#include "optics.h"
#include <stdio.h>
int main(int argc,char **argv) {
if(argc!=2)return 2;
PsfKernelCache cache={0};const PointSpreadFunction psf={2.7,4.5};
if(psf_kernel_cache_init(&cache,&psf,1e-8))return 1;
FILE *out=fopen(argv[1],"wx");if(!out)return 2;
fprintf(out,"PSFEVENTS1 128 96 32771 2.7 4.5 1e-8\n");
int clipped=0;
for(int i=0;i<32771;++i) {
const double phases[]={0,0.25,0.5,0.999999999};
double x=-12+(i*7)%152+phases[i%4], y=-10+(i*11)%116+phases[(i/4)%4];
if(i%5==0){x=63.25;y=47.75;}
PsfCachedEvent e;LinearRgb color={0.7,0.2,0.5};
const int state=psf_prepare_cached_event(&e,x,y,color,i%1024==0?1000:0.01,&psf,&cache,1e8,1e-8,0);
if(state!=0 && state!=2)return 1;
clipped+=state==2;
fprintf(out,"%.17g %.17g %.17g %.17g %.17g %.17g %.17g\n",e.x,e.y,e.color.r,e.color.g,e.color.b,e.flux,e.support_radius);
}
fprintf(stderr,"synthetic fixture: events=32771 wing_clipped=%d; three chunks, exact/in-between phases, edges, hotspots\n",clipped);
const int failed=ferror(out);const int close_result=fclose(out);
psf_kernel_cache_destroy(&cache);
return failed || close_result ? 1:0;
}