Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions cuda_core/tests/memory_ipc/test_peer_access.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ def test_main(self, ipc_mempool_device_x2, grant_access_in_parent):
buffer = mr.allocate(NBYTES, stream=dev1.default_stream)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

codex gpt-5.6-sol ultra found:

This allocates asynchronously on dev1.default_stream, while PatternGen(dev1, ...) creates a separate nonblocking stream and initializes the buffer there. The later dev1.sync() waits for both streams, but does not establish allocation-before-copy ordering. CUDA defines that cross-stream access as undefined unless explicitly ordered. CUDA documentation (https://docs.nvidia.com/cuda/cuda-programming-guide/04-special-topics/stream-ordered-memory-allocation.html).

I’d use one stream throughout:

        stream = dev1.default_stream
        buffer = mr.allocate(NBYTES, stream=stream)
        pgen = PatternGen(dev1, NBYTES, stream=stream)
        pgen.fill_buffer(buffer, seed=False)
        stream.sync()

That also avoids a device-wide barrier.

pgen = PatternGen(dev1, NBYTES)
pgen.fill_buffer(buffer, seed=False)
# IPC import does not carry the exporting process's stream ordering.
dev1.sync()

# Spawn child process
process = mp.Process(target=self.child_main, args=(mr, buffer))
Expand Down
Loading