Synchronize to ensure memory visibility across streams. XPU streams do not guarantee cross-stream memory visibility after a per-stream synchronize, so we use a device-wide sync on XPU. On CUDA, per-stream synchronize is sufficient and preferred.
(self)
| 48 | assert phases_cuda_buffer is not None |
| 49 | self.cuda_buffers = [phases_cuda_buffer[i] for i in range(len(phases_cuda_buffer))] |
| 50 | else: |
| 51 | raise NotImplementedError |
| 52 | |
| 53 | def init_contiguous_group(self, group): |
| 54 | from lightx2v.common.offload.block_layout import ContiguousBlockTransfer |
| 55 | |
| 56 | if group is None: |
| 57 | raise ValueError("No contiguous offload group was registered") |
| 58 | if self.contiguous_transfer is not None: |
| 59 | raise ValueError("An offload manager can initialize only one contiguous group") |
| 60 | slots = list(group.device_slots) |
| 61 | self.contiguous_transfer = ContiguousBlockTransfer(group.blocks, slots) |
| 62 | self.contiguous_group = group |
| 63 | self.cuda_buffers = slots |