Fix: set active CUDA device per layer for BMM/FMHA

This commit is contained in:
2026-05-30 23:39:45 +00:00
parent 7a95983e0f
commit f567c20539

View File

@@ -366,9 +366,10 @@ def main():
target_gpu = li % NUM_GPUS
target_device = f"cuda:{target_gpu}"
# Move activation to layer's GPU
# Move activation to layer's GPU and set as active device
if x.device != torch.device(target_device):
x = x.to(target_device)
torch.cuda.set_device(target_gpu)
lw = layer_weights[li]
rc, rs = rope_caches[target_gpu]