DEBUG: add sync + shape prints to shared_expert L2 gsa copy

This commit is contained in:
2026-06-04 00:05:08 +00:00
parent 1d6610c46d
commit f0f87df906

View File

@@ -363,7 +363,13 @@ class Nvfp4SharedExpert:
# Fused amax + quantize: zero CPU syncs.
if getattr(self, '_use_runtime_gsa', False):
from dsv4.ops.quantize import quantize_nvfp4_gpu_fused
if not intermediate.is_contiguous():
intermediate = intermediate.contiguous()
x_fp4, x_sf, gsa_l2_gpu = quantize_nvfp4_gpu_fused(intermediate)
# DEBUG: verify no CUDA errors from quantize kernel
torch.cuda.synchronize() # DEBUG: catch async errors
if VERBOSE >= 1:
print(f" SE L2 gsa: gsa_gpu shape={tuple(gsa_l2_gpu.shape)} dtype={gsa_l2_gpu.dtype} dev={gsa_l2_gpu.device} _l2_gsa_buf shape={tuple(self._l2_gsa_buf.shape)} dev={self._l2_gsa_buf.device}", flush=True)
self._l2_gsa_buf.copy_(gsa_l2_gpu[:1].reshape(1)) # GPU → GPU, no sync
else:
x_fp4, x_sf = quantize_activation_nvfp4(