Issue |
150904
|
Summary |
[clang-Cuda]: unused command line argument `-fgpu-default-stream=per-thread`
|
Labels |
new issue
|
Assignees |
|
Reporter |
maartenarnst
|
When we use `clang` to compile `cuda` code with `-fgpu-default-stream=per-thread`, we get the warning:
```
warning: argument unused during compilation: '-fgpu-default-stream=per-thread' [-Wunused-command-line-argument]
```
This is a reproducer:
<details>
<summary>
Dockerfile
</summary>
```
FROM nvidia/cuda:12.8.1-devel-ubuntu24.04
# Set up the key ring so that we can use apt update.
ADD https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-keyring_1.0-1_all.deb cuda-keyring_1.0-1_all.deb
RUN <<EOF
set -ex
apt-key del 7fa2af80
rm -f /etc/apt/sources.list.d/cuda.list
rm -f /etc/apt/sources.list.d/nvidia-ml.list
dpkg -i cuda-keyring_1.0-1_all.deb
EOF
# Install requirements.
RUN <<EOF
set -ex
apt update
apt --yes --no-install-recommends install wget software-properties-common
EOF
# Install clang.
RUN <<EOF
set -ex
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
./llvm.sh 20
EOF
# This is a source file to compile.
COPY <<EOF test.cpp
#include "cuda_runtime.h"
__device__ int value_d;
int main() {
const int value_h = 5;
cudaMemcpyToSymbol(
value_d,
&value_h,
sizeof(int),
0,
cudaMemcpyHostToDevice
);
}
EOF
# Compile the source file.
RUN <<EOF
set -ex
clang++-20 -x cuda --cuda-gpu-arch=sm_70 -fgpu-default-stream=per-thread -L/usr/local/cuda/lib64 -lcudart test.cpp
EOF
```
</details>
With this Dockerfile, the issue can be reproduced with:
```
docker buildx build --progress plain --tag reproducer - < Dockerfile
```
I am not sure whether the command line argument is really not taken into account during the compilation, or whether this is a spurious warning. A first step to analyse this issue further may hence be to use Nvidia tooling to see which cuda api calls are made.
- https://github.com/llvm/llvm-project/blob/d532d58974d5f1ccb5c568b67321cc761742152b/clang/lib/CodeGen/CGCUDANV.cpp#L417
Tagging @boxu-zhang and @Artem-B because they submitted the original work on this command line argument:
- https://github.com/llvm/llvm-project/commit/f05b58a9468cc2990678e06bc51df56b30344807
Joint work with @romintomasetti.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs