Two related changes installing the structural guard against the SP6 Pearl 5 IQN τ failure mode (root cause fixed atfacbf76ebfor that one site) and removing the only remaining orphan callers of the broken pattern. The bug class. The mapped_pinned::{upload,clone_to_device}_{f32,i32}_via_pinned helpers are named to suggest "no HtoD per feedback_no_htod_htoh_only_mapped_pinned" but their bodies do MappedXBuffer::new() + memcpy_dtod_async() + stream.synchronize(). The DtoD copy and synchronize are both forbidden inside CUDA Graph capture (CUDA_ERROR_STREAM_CAPTURE_INVALIDATED) and add a host stall otherwise. The canonical pattern is MappedXBuffer stored directly + write_from_slice + kernel reads via .dev_ptr, used by SP4 portfolio_state and SP6 IQN τ atfacbf76eb. Guard. New check_no_dtod_via_pinned in pre-commit-hook.sh rejects any staged .rs file calling upload_(f32|i32)_via_pinned or clone_to_device_(f32|i32)_via_pinned, except mapped_pinned.rs itself. Per feedback_no_hiding: no suppression marker. Also fixes a pre-existing silent-skip bug: the gpu-hotpath-guard.sh invocation used $(cd "$(dirname "$0")" && pwd) which resolved to .git/hooks/ (the symlink's directory) instead of scripts/, so the guard never ran. Replaced with readlink -f "$0" + an explicit "guard missing" error branch — silent skip is worse than no guard. Orphan deletion. gpu_her.rs carried legacy relabel_batch, generate_random_donors (CPU), HerBatch, slice_clone_f32, slice_clone_i32 — zero production callers (verified via grep). Production uses relabel_batch_with_strategy + generate_random_donors_gpu. The orphan held the only upload_i32_via_pinned callers in the codebase; per feedback_no_hiding the right fix is delete. Scope. Eliminates 2 of 47 production *_via_pinned call sites. Remaining 45 across 14 files are cold-path init — graph-capture-fragile and host-stalling but not breaking operationally. Guard enforces no new calls; existing 45 migrate in subsequent atomic per-buffer commits. After all 45 are converted, the four helpers themselves get deleted from mapped_pinned.rs. Validation. Smoke smoke-test-82fjk atfacbf76ebsucceeded — magnitude differentiation restored (q_full=0.462 > q_half=0.409 > q_quarter=0.350 vs baseline frozen Pascal-triangle 0.225/0.280/0.495), eval distribution unfrozen (eq=0.596, eh=0.404, ef=0.000 vs baseline single-action collapse). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
8.1 KiB
Executable File
8.1 KiB
Executable File