Repository navigation
feat(primbench): support an extra backend - #5512
Merged
stanleytsang-amd merged 25 commits intoApr 16, 2026
Merged
Conversation
MyNameIsTrez
force-pushed
the
users/mynameistrez/add-cuda-support-to-primbench
branch
6 times, most recently
from
March 17, 2026 16:35
58d791c to
4743f41
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. ❌ Your project status has failed because the head coverage (77.72%) is below the target coverage (80.00%). You can increase the head coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## develop #5512 +/- ##
========================================
Coverage 65.53% 65.53%
========================================
Files 2045 2045
Lines 318558 318558
Branches 41872 41872
========================================
Hits 208741 208741
Misses 92486 92486
Partials 17331 17331
*This pull request uses carry forward flags. Click here to find out more. 🚀 New features to boost your workflow:
|
MyNameIsTrez
force-pushed
the
users/mynameistrez/add-cuda-support-to-primbench
branch
3 times, most recently
from
March 20, 2026 10:11
d79e040 to
3c4cc9f
Compare
This was referenced Mar 20, 2026
MyNameIsTrez
force-pushed
the
users/mynameistrez/add-cuda-support-to-primbench
branch
3 times, most recently
from
March 28, 2026 01:38
179665c to
b0da0c7
Compare
…compute_max_specialization_width()
MyNameIsTrez
force-pushed
the
users/mynameistrez/add-cuda-support-to-primbench
branch
from
April 10, 2026 16:55
19d397b to
e8b1919
Compare
MyNameIsTrez
marked this pull request as ready for review
April 10, 2026 16:56
MyNameIsTrez
force-pushed
the
users/mynameistrez/add-cuda-support-to-primbench
branch
from
April 14, 2026 15:18
db0b448 to
70cdadb
Compare
stanleytsang-amd
approved these changes
Apr 16, 2026
stanleytsang-amd
deleted the
users/mynameistrez/add-cuda-support-to-primbench
branch
April 16, 2026 21:23
assistant-librarian Bot
pushed a commit
to ROCm/rocPRIM
that referenced
this pull request
Apr 16, 2026
feat(primbench): support an extra backend ## Motivation The PR [feat(rocrand): use primbench](ROCm/rocm-libraries#4454) requires [primbench](https://github.com/ROCm/rocm-libraries/blob/develop/shared/primbench/README.md) to support CUDA, since rocRAND contains cuRAND benchmarks. The PR [feat(primbench): make AMD SMI and NVML soft dependencies](ROCm/rocm-libraries#5637) also depends on this `feat(primbench): support an extra backend` PR, as it depends on the refactored code. ## Technical Details I've spent a few hours on cleaning up the commit history. I recommend reviewing this PR by clicking on the first commit in the [Commits tab](https://github.com/ROCm/rocm-libraries/pull/5512/commits), and then clicking the `Next` button to scroll through the commits chronologically. The first commit is `feat(primbench): support CUDA` and is by far the largest and most complex, so I recommend reviewing the other commits first since they're nice and small. The `feat(primbench): support vector CLI args` commit was also required for rocRAND, since its benchmarks accept an array of values: `--lambda 1 2 3`. ### Two flags were removed Even though this PR adds CUDA support to `primbench.hpp`, it went *down* from 4075 lines to 3593 lines. This is mostly the result of me deciding to remove the flags `--output-hip-device-properties-context` and `--output-amdsmi-context`. These flags were used to dump an extreme amount of extra context to the JSON output, but I have not actually found the extra context useful *even once* while updating all 53 rocPRIM benchmarks to use primbench. Porting these flags to CUDA would have been a nightmare, and removing these two flags has made the library significantly more maintainable. In the future we might decide to output a few of the most useful context fields to the JSON output again. ## Test Plan ### VS Code dev containers <details> <summary>CUDA <code>Dockerfile</code> + <code>devcontainer.json</code></summary> `Dockerfile`: ```Dockerfile FROM nvidia/cuda:12.9.1-devel-ubuntu24.04 RUN apt update && apt install -y git cmake ninja-build wget RUN wget -qO- https://repo.radeon.com/rocm/rocm.gpg.key | gpg --dearmor > /etc/apt/keyrings/rocm.gpg RUN echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/rocm.gpg] https://repo.radeon.com/rocm/apt/7.2 noble main" > /etc/apt/sources.list.d/rocm.list RUN tee /etc/apt/preferences.d/rocm-pin-600 <<'EOF' Package: * Pin: origin repo.radeon.com Pin-Priority: 600 EOF RUN apt update && apt install -y hip-base ENV HIP_PLATFORM=nvidia ``` `devcontainer.json`: ```json { "build": { "dockerfile": "Dockerfile" }, "name": "cuda-minimal", "privileged": true, "runArgs": [ "--gpus=all" ] } ``` </details> <details> <summary>HIP <code>Dockerfile</code> + <code>devcontainer.json</code></summary> `Dockerfile`: ```Dockerfile FROM rocm/rocm-terminal:latest ``` `devcontainer.json`: ```json { "build": { "dockerfile": "Dockerfile" }, "name": "hip-minimal", "runArgs": [ "--device=/dev/kfd", "--device=/dev/dri" ] } ``` </details> ### Setup ```sh git checkout users/mynameistrez/add-cuda-support-to-primbench && \ cd shared/primbench ``` ### Running the CUDA example benchmark ```sh nvcc -o copy_benchmark examples/cuda/copy_benchmark.cu -I. -lnvidia-ml && ./copy_benchmark ``` ### Running the HIP example benchmark ```sh hipcc -o copy_benchmark examples/hip/copy_benchmark.cpp -I. -lamd_smi && ./copy_benchmark ``` ## Test Result The above commands work for me, and the JSON and CSV output looks correct. ## Submission Checklist - [x] Look over the contributing guidelines at https://github.com/ROCm/ROCm/blob/develop/CONTRIBUTING.md#pull-requests.
This was referenced Apr 22, 2026
stanleytsang-amd
pushed a commit
that referenced
this pull request
Apr 22, 2026
## Motivation The PR [[rocPRIM] Warn/Prevent rocPRIM benchmarks from being built on Windows](#5494) was merged as a hotfix, since rocPRIM's benchmarks were not buildable on Windows anymore. This PR its commit `fix(rocprim): revert Windows hotfix PR #5494` reverts that hotfix, and provides a *proper* fix, by turning AMD SMI and NVML from hard dependencies into soft dependencies. This PR will be undrafted once the PR [feat(primbench): support an extra backend](#5512) on which it is based has been merged. ## Technical Details [Here](https://github.com/ROCm/rocm-libraries/tree/users/mynameistrez/make-amdsmi-and-nvml-soft-dependencies/shared/primbench#dependencies) is the updated Dependencies section of the readme: <img width="1353" height="755" alt="image" src="https://github.com/user-attachments/assets/ff8b98b5-1d1c-4fae-a6be-fd2ee7e7415c" /> ## Test Plan ### VS Code dev containers <details> <summary>CUDA <code>Dockerfile</code> + <code>devcontainer.json</code></summary> `Dockerfile`: ```Dockerfile FROM nvidia/cuda:12.9.1-devel-ubuntu24.04 RUN apt update && apt install -y git cmake ninja-build wget RUN wget -qO- https://repo.radeon.com/rocm/rocm.gpg.key | gpg --dearmor > /etc/apt/keyrings/rocm.gpg RUN echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/rocm.gpg] https://repo.radeon.com/rocm/apt/7.2 noble main" > /etc/apt/sources.list.d/rocm.list RUN tee /etc/apt/preferences.d/rocm-pin-600 <<'EOF' Package: * Pin: origin repo.radeon.com Pin-Priority: 600 EOF RUN apt update && apt install -y hip-base ENV HIP_PLATFORM=nvidia ``` `devcontainer.json`: ```json { "build": { "dockerfile": "Dockerfile" }, "name": "cuda-minimal", "privileged": true, "runArgs": [ "--gpus=all" ] } ``` </details> <details> <summary>HIP <code>Dockerfile</code> + <code>devcontainer.json</code></summary> `Dockerfile`: ```Dockerfile FROM rocm/rocm-terminal:latest ``` `devcontainer.json`: ```json { "build": { "dockerfile": "Dockerfile" }, "name": "hip-minimal", "runArgs": [ "--device=/dev/kfd", "--device=/dev/dri" ] } ``` </details> ## Test Result I have confirmed that Stream HPC's CI is now able to build rocPRIM's benchmarks on Windows. It is crucial however for AMD's CI, or one of AMD's reviewers, to confirm that rocPRIM's benchmarks now build and run successfully on Windows for them too. <details> <summary>Monitoring still works</summary> ```sh hipcc -o copy_benchmark examples/hip/copy_benchmark.cpp -I. -lamd_smi && ./copy_benchmark --json-out monitoring.json --csv-out monitoring.csv ``` ```sh nvcc -o copy_benchmark examples/cuda/copy_benchmark.cu -I. -lnvidia-ml && ./copy_benchmark --json-out monitoring.json --csv-out monitoring.csv ``` </details> <details> <summary>Monitoring can now be turned off</summary> ```sh hipcc -o copy_benchmark examples/hip/copy_benchmark.cpp -I. -DPRIMBENCH_NO_MONITORING && ./copy_benchmark --json-out no_monitoring.json --csv-out no_monitoring.csv ``` ```sh nvcc -o copy_benchmark examples/cuda/copy_benchmark.cu -I. -DPRIMBENCH_NO_MONITORING && ./copy_benchmark --json-out no_monitoring.json --csv-out no_monitoring.csv ``` When monitoring is disabled, the `GPU °C` column is excluded from the printed output: ``` Status of copy Noise Bytes/sec Specialization Index/2 ───────────────────────────────────────────────────────────────────── Success after 1s 0.1% 4.08e+11 type: char 0 Success after 1s 0.0% 5.33e+11 type: long long 1 ``` The `monitoring`, `temperature_type` and `gpu_temp_celcius` keys are also excluded from the JSON output: ```diff 23,27d22 < "monitoring": { < "name": "amdsmi", < "version": "25.3.0" < }, < "temperature_type": "edge", 73,76d67 < }, < "gpu_temp_celsius": { < "start": 50, < "end": 48 ``` </details> <details> <summary>Forgetting to pass <code>-DPRIMBENCH_NO_MONITORING</code> throws documented compilation errors</summary> ```sh hipcc -o copy_benchmark examples/hip/copy_benchmark.cpp -I. && ./copy_benchmark ``` ```sh nvcc -o copy_benchmark examples/cuda/copy_benchmark.cu -I. && ./copy_benchmark ``` ``` ld.lld: error: undefined symbol: amdsmi_get_lib_version >>> referenced by copy_benchmark.cpp ``` ``` /usr/bin/ld: /tmp/tmpxft_00007baa_00000000-11_copy_benchmark.o: in function `primbench::detail::monitor::get_temp() const': tmpxft_00007baa_00000000-6_copy_benchmark.cudafe1.cpp:(.text._ZNK9primbench6detail7monitor8get_tempEv[_ZNK9primbench6detail7monitor8get_tempEv]+0x35): undefined reference to `nvmlDeviceGetTemperature' ``` </details> ## Submission Checklist - [x] Look over the contributing guidelines at https://github.com/ROCm/ROCm/blob/develop/CONTRIBUTING.md#pull-requests.
assistant-librarian Bot
pushed a commit
to ROCm/rocPRIM
that referenced
this pull request
Apr 22, 2026
feat(primbench): make AMD SMI and NVML soft dependencies (#5637) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Motivation The PR [[rocPRIM] Warn/Prevent rocPRIM benchmarks from being built on Windows](ROCm/rocm-libraries#5494) was merged as a hotfix, since rocPRIM's benchmarks were not buildable on Windows anymore. This PR its commit `fix(rocprim): revert Windows hotfix PR #5494` reverts that hotfix, and provides a *proper* fix, by turning AMD SMI and NVML from hard dependencies into soft dependencies. This PR will be undrafted once the PR [feat(primbench): support an extra backend](ROCm/rocm-libraries#5512) on which it is based has been merged. ## Technical Details [Here](https://github.com/ROCm/rocm-libraries/tree/users/mynameistrez/make-amdsmi-and-nvml-soft-dependencies/shared/primbench#dependencies) is the updated Dependencies section of the readme: <img width="1353" height="755" alt="image" src="https://github.com/user-attachments/assets/ff8b98b5-1d1c-4fae-a6be-fd2ee7e7415c" /> ## Test Plan ### VS Code dev containers <details> <summary>CUDA <code>Dockerfile</code> + <code>devcontainer.json</code></summary> `Dockerfile`: ```Dockerfile FROM nvidia/cuda:12.9.1-devel-ubuntu24.04 RUN apt update && apt install -y git cmake ninja-build wget RUN wget -qO- https://repo.radeon.com/rocm/rocm.gpg.key | gpg --dearmor > /etc/apt/keyrings/rocm.gpg RUN echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/rocm.gpg] https://repo.radeon.com/rocm/apt/7.2 noble main" > /etc/apt/sources.list.d/rocm.list RUN tee /etc/apt/preferences.d/rocm-pin-600 <<'EOF' Package: * Pin: origin repo.radeon.com Pin-Priority: 600 EOF RUN apt update && apt install -y hip-base ENV HIP_PLATFORM=nvidia ``` `devcontainer.json`: ```json { "build": { "dockerfile": "Dockerfile" }, "name": "cuda-minimal", "privileged": true, "runArgs": [ "--gpus=all" ] } ``` </details> <details> <summary>HIP <code>Dockerfile</code> + <code>devcontainer.json</code></summary> `Dockerfile`: ```Dockerfile FROM rocm/rocm-terminal:latest ``` `devcontainer.json`: ```json { "build": { "dockerfile": "Dockerfile" }, "name": "hip-minimal", "runArgs": [ "--device=/dev/kfd", "--device=/dev/dri" ] } ``` </details> ## Test Result I have confirmed that Stream HPC's CI is now able to build rocPRIM's benchmarks on Windows. It is crucial however for AMD's CI, or one of AMD's reviewers, to confirm that rocPRIM's benchmarks now build and run successfully on Windows for them too. <details> <summary>Monitoring still works</summary> ```sh hipcc -o copy_benchmark examples/hip/copy_benchmark.cpp -I. -lamd_smi && ./copy_benchmark --json-out monitoring.json --csv-out monitoring.csv ``` ```sh nvcc -o copy_benchmark examples/cuda/copy_benchmark.cu -I. -lnvidia-ml && ./copy_benchmark --json-out monitoring.json --csv-out monitoring.csv ``` </details> <details> <summary>Monitoring can now be turned off</summary> ```sh hipcc -o copy_benchmark examples/hip/copy_benchmark.cpp -I. -DPRIMBENCH_NO_MONITORING && ./copy_benchmark --json-out no_monitoring.json --csv-out no_monitoring.csv ``` ```sh nvcc -o copy_benchmark examples/cuda/copy_benchmark.cu -I. -DPRIMBENCH_NO_MONITORING && ./copy_benchmark --json-out no_monitoring.json --csv-out no_monitoring.csv ``` When monitoring is disabled, the `GPU °C` column is excluded from the printed output: ``` Status of copy Noise Bytes/sec Specialization Index/2 ───────────────────────────────────────────────────────────────────── Success after 1s 0.1% 4.08e+11 type: char 0 Success after 1s 0.0% 5.33e+11 type: long long 1 ``` The `monitoring`, `temperature_type` and `gpu_temp_celcius` keys are also excluded from the JSON output: ```diff 23,27d22 < "monitoring": { < "name": "amdsmi", < "version": "25.3.0" < }, < "temperature_type": "edge", 73,76d67 < }, < "gpu_temp_celsius": { < "start": 50, < "end": 48 ``` </details> <details> <summary>Forgetting to pass <code>-DPRIMBENCH_NO_MONITORING</code> throws documented compilation errors</summary> ```sh hipcc -o copy_benchmark examples/hip/copy_benchmark.cpp -I. && ./copy_benchmark ``` ```sh nvcc -o copy_benchmark examples/cuda/copy_benchmark.cu -I. && ./copy_benchmark ``` ``` ld.lld: error: undefined symbol: amdsmi_get_lib_version >>> referenced by copy_benchmark.cpp ``` ``` /usr/bin/ld: /tmp/tmpxft_00007baa_00000000-11_copy_benchmark.o: in function `primbench::detail::monitor::get_temp() const': tmpxft_00007baa_00000000-6_copy_benchmark.cudafe1.cpp:(.text._ZNK9primbench6detail7monitor8get_tempEv[_ZNK9primbench6detail7monitor8get_tempEv]+0x35): undefined reference to `nvmlDeviceGetTemperature' ``` </details> ## Submission Checklist - [x] Look over the contributing guidelines at https://github.com/ROCm/ROCm/blob/develop/CONTRIBUTING.md#pull-requests.
aledudek
pushed a commit
that referenced
this pull request
May 20, 2026
## Motivation The PR [feat(rocrand): use primbench](#4454) requires [primbench](https://github.com/ROCm/rocm-libraries/blob/develop/shared/primbench/README.md) to support CUDA, since rocRAND contains cuRAND benchmarks. The PR [feat(primbench): make AMD SMI and NVML soft dependencies](#5637) also depends on this `feat(primbench): support an extra backend` PR, as it depends on the refactored code. ## Technical Details I've spent a few hours on cleaning up the commit history. I recommend reviewing this PR by clicking on the first commit in the [Commits tab](https://github.com/ROCm/rocm-libraries/pull/5512/commits), and then clicking the `Next` button to scroll through the commits chronologically. The first commit is `feat(primbench): support CUDA` and is by far the largest and most complex, so I recommend reviewing the other commits first since they're nice and small. The `feat(primbench): support vector CLI args` commit was also required for rocRAND, since its benchmarks accept an array of values: `--lambda 1 2 3`. ### Two flags were removed Even though this PR adds CUDA support to `primbench.hpp`, it went *down* from 4075 lines to 3593 lines. This is mostly the result of me deciding to remove the flags `--output-hip-device-properties-context` and `--output-amdsmi-context`. These flags were used to dump an extreme amount of extra context to the JSON output, but I have not actually found the extra context useful *even once* while updating all 53 rocPRIM benchmarks to use primbench. Porting these flags to CUDA would have been a nightmare, and removing these two flags has made the library significantly more maintainable. In the future we might decide to output a few of the most useful context fields to the JSON output again. ## Test Plan ### VS Code dev containers <details> <summary>CUDA <code>Dockerfile</code> + <code>devcontainer.json</code></summary> `Dockerfile`: ```Dockerfile FROM nvidia/cuda:12.9.1-devel-ubuntu24.04 RUN apt update && apt install -y git cmake ninja-build wget RUN wget -qO- https://repo.radeon.com/rocm/rocm.gpg.key | gpg --dearmor > /etc/apt/keyrings/rocm.gpg RUN echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/rocm.gpg] https://repo.radeon.com/rocm/apt/7.2 noble main" > /etc/apt/sources.list.d/rocm.list RUN tee /etc/apt/preferences.d/rocm-pin-600 <<'EOF' Package: * Pin: origin repo.radeon.com Pin-Priority: 600 EOF RUN apt update && apt install -y hip-base ENV HIP_PLATFORM=nvidia ``` `devcontainer.json`: ```json { "build": { "dockerfile": "Dockerfile" }, "name": "cuda-minimal", "privileged": true, "runArgs": [ "--gpus=all" ] } ``` </details> <details> <summary>HIP <code>Dockerfile</code> + <code>devcontainer.json</code></summary> `Dockerfile`: ```Dockerfile FROM rocm/rocm-terminal:latest ``` `devcontainer.json`: ```json { "build": { "dockerfile": "Dockerfile" }, "name": "hip-minimal", "runArgs": [ "--device=/dev/kfd", "--device=/dev/dri" ] } ``` </details> ### Setup ```sh git checkout users/mynameistrez/add-cuda-support-to-primbench && \ cd shared/primbench ``` ### Running the CUDA example benchmark ```sh nvcc -o copy_benchmark examples/cuda/copy_benchmark.cu -I. -lnvidia-ml && ./copy_benchmark ``` ### Running the HIP example benchmark ```sh hipcc -o copy_benchmark examples/hip/copy_benchmark.cpp -I. -lamd_smi && ./copy_benchmark ``` ## Test Result The above commands work for me, and the JSON and CSV output looks correct. ## Submission Checklist - [x] Look over the contributing guidelines at https://github.com/ROCm/ROCm/blob/develop/CONTRIBUTING.md#pull-requests.
aledudek
pushed a commit
that referenced
this pull request
May 20, 2026
## Motivation The PR [[rocPRIM] Warn/Prevent rocPRIM benchmarks from being built on Windows](#5494) was merged as a hotfix, since rocPRIM's benchmarks were not buildable on Windows anymore. This PR its commit `fix(rocprim): revert Windows hotfix PR #5494` reverts that hotfix, and provides a *proper* fix, by turning AMD SMI and NVML from hard dependencies into soft dependencies. This PR will be undrafted once the PR [feat(primbench): support an extra backend](#5512) on which it is based has been merged. ## Technical Details [Here](https://github.com/ROCm/rocm-libraries/tree/users/mynameistrez/make-amdsmi-and-nvml-soft-dependencies/shared/primbench#dependencies) is the updated Dependencies section of the readme: <img width="1353" height="755" alt="image" src="https://github.com/user-attachments/assets/ff8b98b5-1d1c-4fae-a6be-fd2ee7e7415c" /> ## Test Plan ### VS Code dev containers <details> <summary>CUDA <code>Dockerfile</code> + <code>devcontainer.json</code></summary> `Dockerfile`: ```Dockerfile FROM nvidia/cuda:12.9.1-devel-ubuntu24.04 RUN apt update && apt install -y git cmake ninja-build wget RUN wget -qO- https://repo.radeon.com/rocm/rocm.gpg.key | gpg --dearmor > /etc/apt/keyrings/rocm.gpg RUN echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/rocm.gpg] https://repo.radeon.com/rocm/apt/7.2 noble main" > /etc/apt/sources.list.d/rocm.list RUN tee /etc/apt/preferences.d/rocm-pin-600 <<'EOF' Package: * Pin: origin repo.radeon.com Pin-Priority: 600 EOF RUN apt update && apt install -y hip-base ENV HIP_PLATFORM=nvidia ``` `devcontainer.json`: ```json { "build": { "dockerfile": "Dockerfile" }, "name": "cuda-minimal", "privileged": true, "runArgs": [ "--gpus=all" ] } ``` </details> <details> <summary>HIP <code>Dockerfile</code> + <code>devcontainer.json</code></summary> `Dockerfile`: ```Dockerfile FROM rocm/rocm-terminal:latest ``` `devcontainer.json`: ```json { "build": { "dockerfile": "Dockerfile" }, "name": "hip-minimal", "runArgs": [ "--device=/dev/kfd", "--device=/dev/dri" ] } ``` </details> ## Test Result I have confirmed that Stream HPC's CI is now able to build rocPRIM's benchmarks on Windows. It is crucial however for AMD's CI, or one of AMD's reviewers, to confirm that rocPRIM's benchmarks now build and run successfully on Windows for them too. <details> <summary>Monitoring still works</summary> ```sh hipcc -o copy_benchmark examples/hip/copy_benchmark.cpp -I. -lamd_smi && ./copy_benchmark --json-out monitoring.json --csv-out monitoring.csv ``` ```sh nvcc -o copy_benchmark examples/cuda/copy_benchmark.cu -I. -lnvidia-ml && ./copy_benchmark --json-out monitoring.json --csv-out monitoring.csv ``` </details> <details> <summary>Monitoring can now be turned off</summary> ```sh hipcc -o copy_benchmark examples/hip/copy_benchmark.cpp -I. -DPRIMBENCH_NO_MONITORING && ./copy_benchmark --json-out no_monitoring.json --csv-out no_monitoring.csv ``` ```sh nvcc -o copy_benchmark examples/cuda/copy_benchmark.cu -I. -DPRIMBENCH_NO_MONITORING && ./copy_benchmark --json-out no_monitoring.json --csv-out no_monitoring.csv ``` When monitoring is disabled, the `GPU °C` column is excluded from the printed output: ``` Status of copy Noise Bytes/sec Specialization Index/2 ───────────────────────────────────────────────────────────────────── Success after 1s 0.1% 4.08e+11 type: char 0 Success after 1s 0.0% 5.33e+11 type: long long 1 ``` The `monitoring`, `temperature_type` and `gpu_temp_celcius` keys are also excluded from the JSON output: ```diff 23,27d22 < "monitoring": { < "name": "amdsmi", < "version": "25.3.0" < }, < "temperature_type": "edge", 73,76d67 < }, < "gpu_temp_celsius": { < "start": 50, < "end": 48 ``` </details> <details> <summary>Forgetting to pass <code>-DPRIMBENCH_NO_MONITORING</code> throws documented compilation errors</summary> ```sh hipcc -o copy_benchmark examples/hip/copy_benchmark.cpp -I. && ./copy_benchmark ``` ```sh nvcc -o copy_benchmark examples/cuda/copy_benchmark.cu -I. && ./copy_benchmark ``` ``` ld.lld: error: undefined symbol: amdsmi_get_lib_version >>> referenced by copy_benchmark.cpp ``` ``` /usr/bin/ld: /tmp/tmpxft_00007baa_00000000-11_copy_benchmark.o: in function `primbench::detail::monitor::get_temp() const': tmpxft_00007baa_00000000-6_copy_benchmark.cudafe1.cpp:(.text._ZNK9primbench6detail7monitor8get_tempEv[_ZNK9primbench6detail7monitor8get_tempEv]+0x35): undefined reference to `nvmlDeviceGetTemperature' ``` </details> ## Submission Checklist - [x] Look over the contributing guidelines at https://github.com/ROCm/ROCm/blob/develop/CONTRIBUTING.md#pull-requests.
COrruDXC
pushed a commit
to COrruDXC/rocm-libraries
that referenced
this pull request
Jun 4, 2026
## Motivation The PR [feat(rocrand): use primbench](ROCm#4454) requires [primbench](https://github.com/ROCm/rocm-libraries/blob/develop/shared/primbench/README.md) to support CUDA, since rocRAND contains cuRAND benchmarks. The PR [feat(primbench): make AMD SMI and NVML soft dependencies](ROCm#5637) also depends on this `feat(primbench): support an extra backend` PR, as it depends on the refactored code. ## Technical Details I've spent a few hours on cleaning up the commit history. I recommend reviewing this PR by clicking on the first commit in the [Commits tab](https://github.com/ROCm/rocm-libraries/pull/5512/commits), and then clicking the `Next` button to scroll through the commits chronologically. The first commit is `feat(primbench): support CUDA` and is by far the largest and most complex, so I recommend reviewing the other commits first since they're nice and small. The `feat(primbench): support vector CLI args` commit was also required for rocRAND, since its benchmarks accept an array of values: `--lambda 1 2 3`. ### Two flags were removed Even though this PR adds CUDA support to `primbench.hpp`, it went *down* from 4075 lines to 3593 lines. This is mostly the result of me deciding to remove the flags `--output-hip-device-properties-context` and `--output-amdsmi-context`. These flags were used to dump an extreme amount of extra context to the JSON output, but I have not actually found the extra context useful *even once* while updating all 53 rocPRIM benchmarks to use primbench. Porting these flags to CUDA would have been a nightmare, and removing these two flags has made the library significantly more maintainable. In the future we might decide to output a few of the most useful context fields to the JSON output again. ## Test Plan ### VS Code dev containers <details> <summary>CUDA <code>Dockerfile</code> + <code>devcontainer.json</code></summary> `Dockerfile`: ```Dockerfile FROM nvidia/cuda:12.9.1-devel-ubuntu24.04 RUN apt update && apt install -y git cmake ninja-build wget RUN wget -qO- https://repo.radeon.com/rocm/rocm.gpg.key | gpg --dearmor > /etc/apt/keyrings/rocm.gpg RUN echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/rocm.gpg] https://repo.radeon.com/rocm/apt/7.2 noble main" > /etc/apt/sources.list.d/rocm.list RUN tee /etc/apt/preferences.d/rocm-pin-600 <<'EOF' Package: * Pin: origin repo.radeon.com Pin-Priority: 600 EOF RUN apt update && apt install -y hip-base ENV HIP_PLATFORM=nvidia ``` `devcontainer.json`: ```json { "build": { "dockerfile": "Dockerfile" }, "name": "cuda-minimal", "privileged": true, "runArgs": [ "--gpus=all" ] } ``` </details> <details> <summary>HIP <code>Dockerfile</code> + <code>devcontainer.json</code></summary> `Dockerfile`: ```Dockerfile FROM rocm/rocm-terminal:latest ``` `devcontainer.json`: ```json { "build": { "dockerfile": "Dockerfile" }, "name": "hip-minimal", "runArgs": [ "--device=/dev/kfd", "--device=/dev/dri" ] } ``` </details> ### Setup ```sh git checkout users/mynameistrez/add-cuda-support-to-primbench && \ cd shared/primbench ``` ### Running the CUDA example benchmark ```sh nvcc -o copy_benchmark examples/cuda/copy_benchmark.cu -I. -lnvidia-ml && ./copy_benchmark ``` ### Running the HIP example benchmark ```sh hipcc -o copy_benchmark examples/hip/copy_benchmark.cpp -I. -lamd_smi && ./copy_benchmark ``` ## Test Result The above commands work for me, and the JSON and CSV output looks correct. ## Submission Checklist - [x] Look over the contributing guidelines at https://github.com/ROCm/ROCm/blob/develop/CONTRIBUTING.md#pull-requests.
stanleytsang-amd
pushed a commit
that referenced
this pull request
Sep 18, 2026
## Motivation The PR [feat(rocrand): use primbench](#4454) requires [primbench](https://github.com/ROCm/rocm-libraries/blob/develop/shared/primbench/README.md) to support CUDA, since rocRAND contains cuRAND benchmarks. The PR [feat(primbench): make AMD SMI and NVML soft dependencies](#5637) also depends on this `feat(primbench): support an extra backend` PR, as it depends on the refactored code. ## Technical Details I've spent a few hours on cleaning up the commit history. I recommend reviewing this PR by clicking on the first commit in the [Commits tab](https://github.com/ROCm/rocm-libraries/pull/5512/commits), and then clicking the `Next` button to scroll through the commits chronologically. The first commit is `feat(primbench): support CUDA` and is by far the largest and most complex, so I recommend reviewing the other commits first since they're nice and small. The `feat(primbench): support vector CLI args` commit was also required for rocRAND, since its benchmarks accept an array of values: `--lambda 1 2 3`. ### Two flags were removed Even though this PR adds CUDA support to `primbench.hpp`, it went *down* from 4075 lines to 3593 lines. This is mostly the result of me deciding to remove the flags `--output-hip-device-properties-context` and `--output-amdsmi-context`. These flags were used to dump an extreme amount of extra context to the JSON output, but I have not actually found the extra context useful *even once* while updating all 53 rocPRIM benchmarks to use primbench. Porting these flags to CUDA would have been a nightmare, and removing these two flags has made the library significantly more maintainable. In the future we might decide to output a few of the most useful context fields to the JSON output again. ## Test Plan ### VS Code dev containers <details> <summary>CUDA <code>Dockerfile</code> + <code>devcontainer.json</code></summary> `Dockerfile`: ```Dockerfile FROM nvidia/cuda:12.9.1-devel-ubuntu24.04 RUN apt update && apt install -y git cmake ninja-build wget RUN wget -qO- https://repo.radeon.com/rocm/rocm.gpg.key | gpg --dearmor > /etc/apt/keyrings/rocm.gpg RUN echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/rocm.gpg] https://repo.radeon.com/rocm/apt/7.2 noble main" > /etc/apt/sources.list.d/rocm.list RUN tee /etc/apt/preferences.d/rocm-pin-600 <<'EOF' Package: * Pin: origin repo.radeon.com Pin-Priority: 600 EOF RUN apt update && apt install -y hip-base ENV HIP_PLATFORM=nvidia ``` `devcontainer.json`: ```json { "build": { "dockerfile": "Dockerfile" }, "name": "cuda-minimal", "privileged": true, "runArgs": [ "--gpus=all" ] } ``` </details> <details> <summary>HIP <code>Dockerfile</code> + <code>devcontainer.json</code></summary> `Dockerfile`: ```Dockerfile FROM rocm/rocm-terminal:latest ``` `devcontainer.json`: ```json { "build": { "dockerfile": "Dockerfile" }, "name": "hip-minimal", "runArgs": [ "--device=/dev/kfd", "--device=/dev/dri" ] } ``` </details> ### Setup ```sh git checkout users/mynameistrez/add-cuda-support-to-primbench && \ cd shared/primbench ``` ### Running the CUDA example benchmark ```sh nvcc -o copy_benchmark examples/cuda/copy_benchmark.cu -I. -lnvidia-ml && ./copy_benchmark ``` ### Running the HIP example benchmark ```sh hipcc -o copy_benchmark examples/hip/copy_benchmark.cpp -I. -lamd_smi && ./copy_benchmark ``` ## Test Result The above commands work for me, and the JSON and CSV output looks correct. ## Submission Checklist - [x] Look over the contributing guidelines at https://github.com/ROCm/ROCm/blob/develop/CONTRIBUTING.md#pull-requests.
stanleytsang-amd
pushed a commit
that referenced
this pull request
Sep 18, 2026
## Motivation The PR [[rocPRIM] Warn/Prevent rocPRIM benchmarks from being built on Windows](#5494) was merged as a hotfix, since rocPRIM's benchmarks were not buildable on Windows anymore. This PR its commit `fix(rocprim): revert Windows hotfix PR #5494` reverts that hotfix, and provides a *proper* fix, by turning AMD SMI and NVML from hard dependencies into soft dependencies. This PR will be undrafted once the PR [feat(primbench): support an extra backend](#5512) on which it is based has been merged. ## Technical Details [Here](https://github.com/ROCm/rocm-libraries/tree/users/mynameistrez/make-amdsmi-and-nvml-soft-dependencies/shared/primbench#dependencies) is the updated Dependencies section of the readme: <img width="1353" height="755" alt="image" src="https://github.com/user-attachments/assets/ff8b98b5-1d1c-4fae-a6be-fd2ee7e7415c" /> ## Test Plan ### VS Code dev containers <details> <summary>CUDA <code>Dockerfile</code> + <code>devcontainer.json</code></summary> `Dockerfile`: ```Dockerfile FROM nvidia/cuda:12.9.1-devel-ubuntu24.04 RUN apt update && apt install -y git cmake ninja-build wget RUN wget -qO- https://repo.radeon.com/rocm/rocm.gpg.key | gpg --dearmor > /etc/apt/keyrings/rocm.gpg RUN echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/rocm.gpg] https://repo.radeon.com/rocm/apt/7.2 noble main" > /etc/apt/sources.list.d/rocm.list RUN tee /etc/apt/preferences.d/rocm-pin-600 <<'EOF' Package: * Pin: origin repo.radeon.com Pin-Priority: 600 EOF RUN apt update && apt install -y hip-base ENV HIP_PLATFORM=nvidia ``` `devcontainer.json`: ```json { "build": { "dockerfile": "Dockerfile" }, "name": "cuda-minimal", "privileged": true, "runArgs": [ "--gpus=all" ] } ``` </details> <details> <summary>HIP <code>Dockerfile</code> + <code>devcontainer.json</code></summary> `Dockerfile`: ```Dockerfile FROM rocm/rocm-terminal:latest ``` `devcontainer.json`: ```json { "build": { "dockerfile": "Dockerfile" }, "name": "hip-minimal", "runArgs": [ "--device=/dev/kfd", "--device=/dev/dri" ] } ``` </details> ## Test Result I have confirmed that Stream HPC's CI is now able to build rocPRIM's benchmarks on Windows. It is crucial however for AMD's CI, or one of AMD's reviewers, to confirm that rocPRIM's benchmarks now build and run successfully on Windows for them too. <details> <summary>Monitoring still works</summary> ```sh hipcc -o copy_benchmark examples/hip/copy_benchmark.cpp -I. -lamd_smi && ./copy_benchmark --json-out monitoring.json --csv-out monitoring.csv ``` ```sh nvcc -o copy_benchmark examples/cuda/copy_benchmark.cu -I. -lnvidia-ml && ./copy_benchmark --json-out monitoring.json --csv-out monitoring.csv ``` </details> <details> <summary>Monitoring can now be turned off</summary> ```sh hipcc -o copy_benchmark examples/hip/copy_benchmark.cpp -I. -DPRIMBENCH_NO_MONITORING && ./copy_benchmark --json-out no_monitoring.json --csv-out no_monitoring.csv ``` ```sh nvcc -o copy_benchmark examples/cuda/copy_benchmark.cu -I. -DPRIMBENCH_NO_MONITORING && ./copy_benchmark --json-out no_monitoring.json --csv-out no_monitoring.csv ``` When monitoring is disabled, the `GPU °C` column is excluded from the printed output: ``` Status of copy Noise Bytes/sec Specialization Index/2 ───────────────────────────────────────────────────────────────────── Success after 1s 0.1% 4.08e+11 type: char 0 Success after 1s 0.0% 5.33e+11 type: long long 1 ``` The `monitoring`, `temperature_type` and `gpu_temp_celcius` keys are also excluded from the JSON output: ```diff 23,27d22 < "monitoring": { < "name": "amdsmi", < "version": "25.3.0" < }, < "temperature_type": "edge", 73,76d67 < }, < "gpu_temp_celsius": { < "start": 50, < "end": 48 ``` </details> <details> <summary>Forgetting to pass <code>-DPRIMBENCH_NO_MONITORING</code> throws documented compilation errors</summary> ```sh hipcc -o copy_benchmark examples/hip/copy_benchmark.cpp -I. && ./copy_benchmark ``` ```sh nvcc -o copy_benchmark examples/cuda/copy_benchmark.cu -I. && ./copy_benchmark ``` ``` ld.lld: error: undefined symbol: amdsmi_get_lib_version >>> referenced by copy_benchmark.cpp ``` ``` /usr/bin/ld: /tmp/tmpxft_00007baa_00000000-11_copy_benchmark.o: in function `primbench::detail::monitor::get_temp() const': tmpxft_00007baa_00000000-6_copy_benchmark.cudafe1.cpp:(.text._ZNK9primbench6detail7monitor8get_tempEv[_ZNK9primbench6detail7monitor8get_tempEv]+0x35): undefined reference to `nvmlDeviceGetTemperature' ``` </details> ## Submission Checklist - [x] Look over the contributing guidelines at https://github.com/ROCm/ROCm/blob/develop/CONTRIBUTING.md#pull-requests.
illsilin
pushed a commit
to igorluppi/rocm-libraries
that referenced
this pull request
Oct 1, 2026
## Motivation The PR [feat(rocrand): use primbench](ROCm#4454) requires [primbench](https://github.com/ROCm/rocm-libraries/blob/develop/shared/primbench/README.md) to support CUDA, since rocRAND contains cuRAND benchmarks. The PR [feat(primbench): make AMD SMI and NVML soft dependencies](ROCm#5637) also depends on this `feat(primbench): support an extra backend` PR, as it depends on the refactored code. ## Technical Details I've spent a few hours on cleaning up the commit history. I recommend reviewing this PR by clicking on the first commit in the [Commits tab](https://github.com/ROCm/rocm-libraries/pull/5512/commits), and then clicking the `Next` button to scroll through the commits chronologically. The first commit is `feat(primbench): support CUDA` and is by far the largest and most complex, so I recommend reviewing the other commits first since they're nice and small. The `feat(primbench): support vector CLI args` commit was also required for rocRAND, since its benchmarks accept an array of values: `--lambda 1 2 3`. ### Two flags were removed Even though this PR adds CUDA support to `primbench.hpp`, it went *down* from 4075 lines to 3593 lines. This is mostly the result of me deciding to remove the flags `--output-hip-device-properties-context` and `--output-amdsmi-context`. These flags were used to dump an extreme amount of extra context to the JSON output, but I have not actually found the extra context useful *even once* while updating all 53 rocPRIM benchmarks to use primbench. Porting these flags to CUDA would have been a nightmare, and removing these two flags has made the library significantly more maintainable. In the future we might decide to output a few of the most useful context fields to the JSON output again. ## Test Plan ### VS Code dev containers <details> <summary>CUDA <code>Dockerfile</code> + <code>devcontainer.json</code></summary> `Dockerfile`: ```Dockerfile FROM nvidia/cuda:12.9.1-devel-ubuntu24.04 RUN apt update && apt install -y git cmake ninja-build wget RUN wget -qO- https://repo.radeon.com/rocm/rocm.gpg.key | gpg --dearmor > /etc/apt/keyrings/rocm.gpg RUN echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/rocm.gpg] https://repo.radeon.com/rocm/apt/7.2 noble main" > /etc/apt/sources.list.d/rocm.list RUN tee /etc/apt/preferences.d/rocm-pin-600 <<'EOF' Package: * Pin: origin repo.radeon.com Pin-Priority: 600 EOF RUN apt update && apt install -y hip-base ENV HIP_PLATFORM=nvidia ``` `devcontainer.json`: ```json { "build": { "dockerfile": "Dockerfile" }, "name": "cuda-minimal", "privileged": true, "runArgs": [ "--gpus=all" ] } ``` </details> <details> <summary>HIP <code>Dockerfile</code> + <code>devcontainer.json</code></summary> `Dockerfile`: ```Dockerfile FROM rocm/rocm-terminal:latest ``` `devcontainer.json`: ```json { "build": { "dockerfile": "Dockerfile" }, "name": "hip-minimal", "runArgs": [ "--device=/dev/kfd", "--device=/dev/dri" ] } ``` </details> ### Setup ```sh git checkout users/mynameistrez/add-cuda-support-to-primbench && \ cd shared/primbench ``` ### Running the CUDA example benchmark ```sh nvcc -o copy_benchmark examples/cuda/copy_benchmark.cu -I. -lnvidia-ml && ./copy_benchmark ``` ### Running the HIP example benchmark ```sh hipcc -o copy_benchmark examples/hip/copy_benchmark.cpp -I. -lamd_smi && ./copy_benchmark ``` ## Test Result The above commands work for me, and the JSON and CSV output looks correct. ## Submission Checklist - [x] Look over the contributing guidelines at https://github.com/ROCm/ROCm/blob/develop/CONTRIBUTING.md#pull-requests.
illsilin
pushed a commit
to igorluppi/rocm-libraries
that referenced
this pull request
Oct 1, 2026
## Motivation The PR [[rocPRIM] Warn/Prevent rocPRIM benchmarks from being built on Windows](ROCm#5494) was merged as a hotfix, since rocPRIM's benchmarks were not buildable on Windows anymore. This PR its commit `fix(rocprim): revert Windows hotfix PR ROCm#5494` reverts that hotfix, and provides a *proper* fix, by turning AMD SMI and NVML from hard dependencies into soft dependencies. This PR will be undrafted once the PR [feat(primbench): support an extra backend](ROCm#5512) on which it is based has been merged. ## Technical Details [Here](https://github.com/ROCm/rocm-libraries/tree/users/mynameistrez/make-amdsmi-and-nvml-soft-dependencies/shared/primbench#dependencies) is the updated Dependencies section of the readme: <img width="1353" height="755" alt="image" src="https://github.com/user-attachments/assets/ff8b98b5-1d1c-4fae-a6be-fd2ee7e7415c" /> ## Test Plan ### VS Code dev containers <details> <summary>CUDA <code>Dockerfile</code> + <code>devcontainer.json</code></summary> `Dockerfile`: ```Dockerfile FROM nvidia/cuda:12.9.1-devel-ubuntu24.04 RUN apt update && apt install -y git cmake ninja-build wget RUN wget -qO- https://repo.radeon.com/rocm/rocm.gpg.key | gpg --dearmor > /etc/apt/keyrings/rocm.gpg RUN echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/rocm.gpg] https://repo.radeon.com/rocm/apt/7.2 noble main" > /etc/apt/sources.list.d/rocm.list RUN tee /etc/apt/preferences.d/rocm-pin-600 <<'EOF' Package: * Pin: origin repo.radeon.com Pin-Priority: 600 EOF RUN apt update && apt install -y hip-base ENV HIP_PLATFORM=nvidia ``` `devcontainer.json`: ```json { "build": { "dockerfile": "Dockerfile" }, "name": "cuda-minimal", "privileged": true, "runArgs": [ "--gpus=all" ] } ``` </details> <details> <summary>HIP <code>Dockerfile</code> + <code>devcontainer.json</code></summary> `Dockerfile`: ```Dockerfile FROM rocm/rocm-terminal:latest ``` `devcontainer.json`: ```json { "build": { "dockerfile": "Dockerfile" }, "name": "hip-minimal", "runArgs": [ "--device=/dev/kfd", "--device=/dev/dri" ] } ``` </details> ## Test Result I have confirmed that Stream HPC's CI is now able to build rocPRIM's benchmarks on Windows. It is crucial however for AMD's CI, or one of AMD's reviewers, to confirm that rocPRIM's benchmarks now build and run successfully on Windows for them too. <details> <summary>Monitoring still works</summary> ```sh hipcc -o copy_benchmark examples/hip/copy_benchmark.cpp -I. -lamd_smi && ./copy_benchmark --json-out monitoring.json --csv-out monitoring.csv ``` ```sh nvcc -o copy_benchmark examples/cuda/copy_benchmark.cu -I. -lnvidia-ml && ./copy_benchmark --json-out monitoring.json --csv-out monitoring.csv ``` </details> <details> <summary>Monitoring can now be turned off</summary> ```sh hipcc -o copy_benchmark examples/hip/copy_benchmark.cpp -I. -DPRIMBENCH_NO_MONITORING && ./copy_benchmark --json-out no_monitoring.json --csv-out no_monitoring.csv ``` ```sh nvcc -o copy_benchmark examples/cuda/copy_benchmark.cu -I. -DPRIMBENCH_NO_MONITORING && ./copy_benchmark --json-out no_monitoring.json --csv-out no_monitoring.csv ``` When monitoring is disabled, the `GPU °C` column is excluded from the printed output: ``` Status of copy Noise Bytes/sec Specialization Index/2 ───────────────────────────────────────────────────────────────────── Success after 1s 0.1% 4.08e+11 type: char 0 Success after 1s 0.0% 5.33e+11 type: long long 1 ``` The `monitoring`, `temperature_type` and `gpu_temp_celcius` keys are also excluded from the JSON output: ```diff 23,27d22 < "monitoring": { < "name": "amdsmi", < "version": "25.3.0" < }, < "temperature_type": "edge", 73,76d67 < }, < "gpu_temp_celsius": { < "start": 50, < "end": 48 ``` </details> <details> <summary>Forgetting to pass <code>-DPRIMBENCH_NO_MONITORING</code> throws documented compilation errors</summary> ```sh hipcc -o copy_benchmark examples/hip/copy_benchmark.cpp -I. && ./copy_benchmark ``` ```sh nvcc -o copy_benchmark examples/cuda/copy_benchmark.cu -I. && ./copy_benchmark ``` ``` ld.lld: error: undefined symbol: amdsmi_get_lib_version >>> referenced by copy_benchmark.cpp ``` ``` /usr/bin/ld: /tmp/tmpxft_00007baa_00000000-11_copy_benchmark.o: in function `primbench::detail::monitor::get_temp() const': tmpxft_00007baa_00000000-6_copy_benchmark.cudafe1.cpp:(.text._ZNK9primbench6detail7monitor8get_tempEv[_ZNK9primbench6detail7monitor8get_tempEv]+0x35): undefined reference to `nvmlDeviceGetTemperature' ``` </details> ## Submission Checklist - [x] Look over the contributing guidelines at https://github.com/ROCm/ROCm/blob/develop/CONTRIBUTING.md#pull-requests.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
The PR feat(rocrand): use primbench requires primbench to support CUDA, since rocRAND contains cuRAND benchmarks.
The PR feat(primbench): make AMD SMI and NVML soft dependencies also depends on this
feat(primbench): support an extra backendPR, as it depends on the refactored code.Technical Details
I've spent a few hours on cleaning up the commit history. I recommend reviewing this PR by clicking on the first commit in the Commits tab, and then clicking the
Nextbutton to scroll through the commits chronologically.The first commit is
feat(primbench): support CUDAand is by far the largest and most complex, so I recommend reviewing the other commits first since they're nice and small.The
feat(primbench): support vector CLI argscommit was also required for rocRAND, since its benchmarks accept an array of values:--lambda 1 2 3.Two flags were removed
Even though this PR adds CUDA support to
primbench.hpp, it went down from 4075 lines to 3593 lines. This is mostly the result of me deciding to remove the flags--output-hip-device-properties-contextand--output-amdsmi-context.These flags were used to dump an extreme amount of extra context to the JSON output, but I have not actually found the extra context useful even once while updating all 53 rocPRIM benchmarks to use primbench.
Porting these flags to CUDA would have been a nightmare, and removing these two flags has made the library significantly more maintainable. In the future we might decide to output a few of the most useful context fields to the JSON output again.
Test Plan
VS Code dev containers
CUDA
Dockerfile+devcontainer.jsonDockerfile:devcontainer.json:{ "build": { "dockerfile": "Dockerfile" }, "name": "cuda-minimal", "privileged": true, "runArgs": [ "--gpus=all" ] }HIP
Dockerfile+devcontainer.jsonDockerfile:FROM rocm/rocm-terminal:latestdevcontainer.json:{ "build": { "dockerfile": "Dockerfile" }, "name": "hip-minimal", "runArgs": [ "--device=/dev/kfd", "--device=/dev/dri" ] }Setup
Running the CUDA example benchmark
nvcc -o copy_benchmark examples/cuda/copy_benchmark.cu -I. -lnvidia-ml && ./copy_benchmarkRunning the HIP example benchmark
hipcc -o copy_benchmark examples/hip/copy_benchmark.cpp -I. -lamd_smi && ./copy_benchmarkTest Result
The above commands work for me, and the JSON and CSV output looks correct.
Submission Checklist