This is an archive of the discontinued LLVM Phabricator instance.

[clang] Support '-fgpu-default-stream=per-thread' for NVIDIA CUDA
ClosedPublic

Authored by boxu-zhang on Jul 10 2023, 2:08 AM.

Details

Summary

I'm using clang to compile CUDA code. And just found that clang doesn't support the per-thread stream option for NV CUDA. I don't know if there is another solution.

Diff Detail

Event Timeline

boxu-zhang created this revision.Jul 10 2023, 2:08 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 10 2023, 2:08 AM
Herald added subscribers: mattd, yaxunl. · View Herald Transcript
boxu-zhang requested review of this revision.Jul 10 2023, 2:08 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 10 2023, 2:08 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
boxu-zhang edited the summary of this revision. (Show Details)Jul 10 2023, 2:20 AM
boxu-zhang added reviewers: jansvoboda11, rjmccall.
tra added a reviewer: tra.Jul 10 2023, 9:32 AM
tra added a subscriber: tra.

Looking at CUDA headers, it appears that changing only compiler-generated-glue may be insufficient. A lot of other CUDA API calls need to be changed to _ptsz variant and for that we need to have CUDA_API_PER_THREAD_DEFAULT_STREAM defined.

jansvoboda11 resigned from this revision.Jul 10 2023, 9:33 AM

Append 'CUDA_API_PER_THREAD_DEFAULT_STREAM' as a defined macro

Looking at CUDA headers, it appears that changing only compiler-generated-glue may be insufficient. A lot of other CUDA API calls need to be changed to _ptsz variant and for that we need to have CUDA_API_PER_THREAD_DEFAULT_STREAM defined.

CUDA_API_PER_THREAD_DEFAULT_STREAM is defined now.

Another point that I don't get is why the libcxx CI failed. Anyone know the reason this message?
"
Running global pre-checkout hook
Preparing working directory
Running global post-checkout hook
Running commands
$ trap 'kill -- $$' INT TERM QUIT; libcxx/utils/ci/generate-buildkite-pipeline | buildkite-agent pipeline upload
2023-07-11 02:36:45 INFO Reading pipeline config from STDIN
2023-07-11 02:36:46 INFO Updating BUILDKITE_COMMIT to "a297905cd83911c8a03f060cb9d96bc99aae3f8c"
2023-07-11 02:36:46 FATAL Pipeline parsing of "(stdin)" failed (Expected identifier to start with a letter, got ')
🚨 Error: The command exited with status 1
user command error: exit status 1
"

boxu-zhang retitled this revision from Support '-fgpu-default-stream=per-thread' for NVIDIA CUDA to [clang] Support '-fgpu-default-stream=per-thread' for NVIDIA CUDA.

Add component 'clang' in commit message

tra accepted this revision.Jul 11 2023, 11:50 AM
This revision is now accepted and ready to land.Jul 11 2023, 11:50 AM

I don't have the permission to push to main branch. Can anyone push this?

tra added a comment.Jul 12 2023, 10:45 AM

Can anyone push this?

I can help with this. How do you want your commit to be attributed? The patch currently has boxu.zhang <boxu.zhang@hotmail.com>. Do you want it to be changed to something else?

boxu-zhang added a comment.EditedJul 12 2023, 7:30 PM

Can anyone push this?

I can help with this. How do you want your commit to be attributed? The patch currently has boxu.zhang <boxu.zhang@hotmail.com>. Do you want it to be changed to something else?

Just use that, it's my real name and mailbox, thanks for your help. :)

This revision was landed with ongoing or failed builds.Jul 13 2023, 4:55 PM
This revision was automatically updated to reflect the committed changes.