Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CIR][CUDA] Add attribute for CUDA fat binary name #1377

Merged
merged 1 commit into from
Feb 22, 2025

Conversation

AdUhTkJm
Copy link
Contributor

This is a preparation of generating registration functions in LoweringPrepare.

CUDA compilation works as follows (irrelevant arguments omitted):

# First compile for device, generating PTX assembly
clang++ test.cu -fcuda-is-device -o device.s

# Convert that into a binary file
ptxas device.s --output-file device.o
fatbin --create device.fatbin --image=profile=sm_52,file=device.o

# Pass that file as an argument to host
clang++ test.cu -fcuda-include-gpubinary device.fatbin -cuid="some unique id"

And from the name of GPU binary, we can obtain a handle for registration. So we add an attribute to ModuleOp, recording that name.

If that -fcuda-include-gpubinary is not specified (like in the test simple.cu), OG will not generate any registration function. We do the same here by not generating the attribute.

Copy link

github-actions bot commented Feb 20, 2025

✅ With the latest revision this PR passed the C/C++ code formatter.

Copy link
Member

@bcardosolopes bcardosolopes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM after fixing minor nits

@bcardosolopes bcardosolopes merged commit dda69c8 into llvm:main Feb 22, 2025
6 checks passed
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.

2 participants