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

Allow disabling the linking of libdevice in CUDACompilerParams #2611

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gbaraldi
Copy link

@gbaraldi gbaraldi commented Jan 8, 2025

Add option to disable the linking of libdevice into the IR.
This is needed because https://github.com/EnzymeAD/Reactant.jl requires the intrinsics and not their linked code to raise LLVM IR into MLIR
I imagine this can only be properly tested downstream

@@ -3,12 +3,14 @@
Base.@kwdef struct CUDACompilerParams <: AbstractCompilerParams
cap::VersionNumber
ptx::VersionNumber
link_libdevice::Bool # Used by Reactant.jl
Copy link
Member

Choose a reason for hiding this comment

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

We're using @kwdef

Suggested change
link_libdevice::Bool # Used by Reactant.jl
# for Reactant.jl, which raises NVVM intrinsics to MLIR
link_libdevice::Bool = true

end

CUDACompilerParams(;cap::VersionNumber, ptx::VersionNumber) = CUDACompilerParams(cap=cap, ptx=ptx, link_libdevice=true)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
CUDACompilerParams(;cap::VersionNumber, ptx::VersionNumber) = CUDACompilerParams(cap=cap, ptx=ptx, link_libdevice=true)

Comment on lines +32 to +34
if !job.config.params.link_libdevice
return # Don't link libdevice, used by Reactant.jl to raise NVVM intrinsics into MLIR
end
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if !job.config.params.link_libdevice
return # Don't link libdevice, used by Reactant.jl to raise NVVM intrinsics into MLIR
end
job.config.params.link_libdevice || return

@wsmoses
Copy link
Contributor

wsmoses commented Jan 9, 2025

@gbaraldi one small thing : if the flag is set, can __nv_ functions as a legal intrinsic ?

fn == "__nvvm_reflect" || startswith(fn, "cuda")

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.

3 participants