Skip to content

Perftest: Check DMA-BUF memory types after option parsing - #421

Open
0z5a wants to merge 1 commit into
linux-rdma:masterfrom
0z5a:fix/dmabuf-option-order
Open

0z5a wants to merge 1 commit into
linux-rdma:masterfrom
0z5a:fix/dmabuf-option-order

Conversation

@0z5a

@0z5a 0z5a commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

--use_cuda_dmabuf checked the memory type while the options were still being parsed, so it failed with "CUDA DMA-BUF cannot be used without CUDA" whenever it came before --use_cuda or --use_cuda_bus_id. The MUSA, ROCm, Neuron and MLU DMA-BUF options had the same check. This moves the five checks after the parsing loop, next to the existing data-direct and PCIe-mapping checks. The error messages are unchanged.

Fixes #336

Tested on GH200 (aarch64) with ConnectX-7, CUDA 13.2, built with HAVE_CUDA_DMABUF, no new build warnings. With an unknown -d to stop right after the parser:

Options master this PR
--use_cuda_dmabuf --use_cuda=0 parser error passes the parser
--use_cuda_dmabuf --use_cuda_bus_id=<addr> parser error passes the parser
--use_cuda_dmabuf --use_cuda=0 --use_cuda_pcie_mapping parser error passes the parser
--use_cuda=0 --use_cuda_dmabuf passes passes
--use_cuda_dmabuf alone parser error same parser error

ib_write_bw loopback on one port, 1 MiB, 2000 iterations, GPU memory through DMA-BUF: 382.48 Gb/s with --use_cuda_dmabuf --use_cuda=0 and 382.40 Gb/s with the options the other way round. The MUSA, ROCm, Neuron and MLU paths were not run.

--cuda_mem_type, --opencl_platform_id, --gpu_touch and --use_opencl (which needs --odp first) still depend on option order. They are left out of this change.

I used Claude, an AI coding assistant, for this change; the commit carries an Assisted-by tag.

--use_cuda_dmabuf checked the memory type while the options were
still being parsed, so it failed with "CUDA DMA-BUF cannot be used
without CUDA" whenever it came before --use_cuda or --use_cuda_bus_id.
The MUSA, ROCm, Neuron and MLU DMA-BUF options had the same check.

Record the DMA-BUF options while parsing and check them against the
final memory type after the loop, next to the other DMA-BUF
dependency checks. The error messages are unchanged.

Fixes: linux-rdma#336
Assisted-by: Claude:claude-opus-5-5 <noreply@anthropic.com>
Signed-off-by: Dezhen Lu <dezhen.lu@student.uni-tuebingen.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Perftest not starting if --use_cuda_dmabuf passed before --use_cuda

1 participant