From f0f87df9061bafdaf34c4857856e72216e01f8ab Mon Sep 17 00:00:00 2001 From: biondizzle Date: Thu, 4 Jun 2026 00:05:08 +0000 Subject: [PATCH] DEBUG: add sync + shape prints to shared_expert L2 gsa copy --- dsv4/layers/shared_expert.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dsv4/layers/shared_expert.py b/dsv4/layers/shared_expert.py index 4d32a548..c5ca22dc 100644 --- a/dsv4/layers/shared_expert.py +++ b/dsv4/layers/shared_expert.py @@ -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(