Skip to content

clang generates ill-formed PTX (parsing error with ptxas) #64365

@ptal

Description

@ptal

Compiling my code in Debug mode leads to a parse error in the PTX. Compiling in mode Release works but crashes at the execution (while nvcc doesn't), perhaps due to the limited support of CUDA 12.1, I have not investigated.

Replicate debug issue:

$ git clone [email protected]:ptal/turbo.git
$ git checkout clang-bug64365
$ cmake -DCMAKE_BUILD_TYPE=Debug -DGPU=ON -Bbuild/gpu-debug-clang -DCMAKE_CUDA_ARCHITECTURES=75 -DCMAKE_CUDA_COMPILER=clang++-18 -DCMAKE_CXX_COMPILER=clang++-18 -DCMAKE_VERBOSE_MAKEFILE=ON -DREDUCE_PTX_SIZE=ON
$ cmake --build build/gpu-debug-clang/
...
ptxas /tmp/turbo-sm_75-e1f897.s, line 5502094; fatal   : Parsing error near '.': syntax error
ptxas fatal   : Ptx assembly aborted due to errors
clang++-18: error: ptxas command failed with exit code 255 (use -v to see invocation)
Ubuntu clang version 18.0.0 (++20230805031655+ce2ec065165b-1~exp1~20230805151815.1104)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
clang++-18: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang++-18: note: diagnostic msg: /tmp/turbo-dcd464.cu
clang++-18: note: diagnostic msg: /tmp/turbo-sm_75-343cfe.cu
clang++-18: note: diagnostic msg: /tmp/turbo-dcd464.sh
clang++-18: note: diagnostic msg: 

********************

Metadata

Metadata

Assignees

No one assigned

    Labels

    backend:NVPTXincompleteIssue not complete (e.g. missing a reproducer, build arguments, etc.)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions