Skip to content

feat: opt-in host-to-device copy for aisio-cpu/posix - #13

Merged
karlowich merged 3 commits into
xnvme:mainfrom
karlowich:feat/copy-to-gpu
Aug 5, 2026
Merged

feat: opt-in host-to-device copy for aisio-cpu/posix#13
karlowich merged 3 commits into
xnvme:mainfrom
karlowich:feat/copy-to-gpu

Conversation

@karlowich

Copy link
Copy Markdown
Collaborator

Adds a --copy-to-gpu option that copies each file from host to device
memory after reading, so the host-to-device transfer that aisio-p2p
avoids is measured explicitly — making the P2P advantage visible in
benchmarks.

  • aisio-cpu: allocates a parallel GPU buffer per host DMA buffer and
    issues one cudaMemcpy H -> D per file once the batch's reads drain. The
    copy is counted in io_time, and the GPU buffers are presented as the
    iterator output (GPU-resident, like aisio-p2p).
  • posix: the existing H -> D copy is now gated behind the same flag.

Also wires the previously-unreachable boolean fil_opts fields into the
Python binding: buffered, async (exposed as async_, since async
is a reserved word in Python), register_bufs, and copy_to_gpu.

Note: The POSIX path previously always copied to GPU. It now only copies
when --copy-to-gpu is passed (default off, symmetric with aisio-cpu).

@karlowich
karlowich requested a review from naddinadja August 4, 2026 13:29
naddinadja
naddinadja previously approved these changes Aug 5, 2026

@naddinadja naddinadja left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I have some questions, but nothing blocking

Comment thread src/io.c
Comment thread python/filmodule.c Outdated
Add a copy_to_gpu option (--copy-to-gpu) that copies each file from host
to device memory after reading. On the aisio-cpu path it allocates a
parallel GPU buffer per host DMA buffer and issues one cudaMemcpy H->D per
file after the reads drain, timed as part of io_time, and presents the
GPU buffers as the iterator output. On the posix path it gates the
existing host->device copy behind the same flag.

This exposes the host-to-device transfer that aisio-p2p avoids, making
the advantage of the P2P path clear.

Signed-off-by: Karl Bonde Torp <k.torp@samsung.com>
Wire the boolean fil_opts fields that the C library already supported but
the Python init() did not: buffered, async, register_bufs and the new
copy_to_gpu. 'async' is a reserved word in Python, so it is exposed under
the keyword 'async_'.

Signed-off-by: Karl Bonde Torp <k.torp@samsung.com>
Signed-off-by: Karl Bonde Torp <k.torp@samsung.com>

@naddinadja naddinadja left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Great! :)

@karlowich
karlowich merged commit dd9b397 into xnvme:main Aug 5, 2026
1 check passed
@karlowich
karlowich deleted the feat/copy-to-gpu branch August 5, 2026 12:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants