Fix leg_analys compile error on devices without subgroups
The analysis kernel is generated from two independent flags: `parity`
(fold north/south latitude pairs, on whenever nlat is even, so always for
the Gauss grid) and `subgroups` (use subgroupAdd for the reduction, only
when the device reports the feature).
Parity mode declares wpv/wmv in place of wfv, and the subgroup branch of
the accumulation loop honored that -- but the shared-memory tree-reduction
fallback hardcoded wfv. So parity + no subgroups emitted a reference to an
undeclared variable:
WGSL compile error in leg_analys: 111:15 unresolved identifier 'wfv'
which every GPU lacking the `subgroups` feature hit on startup.
Give the fallback the same parity split the subgroup path has: c0
accumulates even (l-m) against wpv, c1 odd against wmv.
Verified by forcing SHT_SUBGROUPS=false in the headless runner: the error
reproduces at exactly 111:15 before, and after the fix the suite passes
with analys accuracy 7.42e-7 vs the f64 CPU reference, matching the
subgroup path's 7.39e-7.
1 changed file+7−2
src/sht/wgsl/leg.tsmodified+7−2View file
@@ -305,8 +305,13 @@ ${
305305 var c1 = vec2f(0.0);
306306 for (var k = 0u; k < K; k++) {
307307 if (nyv[k] == 0) {
308- c0 += wfv[k] * y0v[k];
309- c1 += wfv[k] * y1v[k];
308+${
309+ half
310+ ? ` c0 += wpv[k] * y0v[k]; // even (l-m): hemispheres add
311+ c1 += wmv[k] * y1v[k]; // odd (l-m): hemispheres subtract`
312+ : ` c0 += wfv[k] * y0v[k];
313+ c1 += wfv[k] * y1v[k];`
314+ }
310315 } else if (abs(y0v[k]) > RESCALE_THR) {
311316 nyv[k] += 1;
312317 y0v[k] *= INV_SCALE;