pub fn optimize_reuse(cubin: &[u8]) -> (Vec<u8>, usize)Expand description
The reuse-cache optimizer pass — our first SASS optimization ON TOP of ptxas. The operand collector can
REUSE a source register read by the previous instruction instead of re-reading the register file, saving
RF bandwidth (the bottleneck under our 222-register, 16.7%-occupancy kernel). ptxas already sets many reuse
flags; this finds the ones it MISSED: consecutive instructions that read the same register into the same
operand slot (Ra→reuse bit 0 = hi[58], Rb→reuse bit 1 = hi[59]) but where the flag is unset. RZ is skipped
(reusing the zero register is pointless). Returns the patched cubin bytes and the number of flags added.
The result MUST be validated on-device (varied-fill oracle) — the operand→slot mapping is verified there,
never trusted blind.