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

Draft
wants to merge 3 commits 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

src/compiler/compilation.jl Outdated Show resolved Hide resolved
src/compiler/compilation.jl Outdated Show resolved Hide resolved
src/compiler/compilation.jl Outdated Show resolved Hide resolved
@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")

@maleadt maleadt marked this pull request as draft February 4, 2025 10:38
@maleadt maleadt added enhancement New feature or request speculative Not sure about this one yet. needs changes Changes are needed. labels Feb 4, 2025
Copy link

codecov bot commented Feb 6, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 59.95%. Comparing base (4d85f27) to head (d199899).

Additional details and impacted files
@@             Coverage Diff             @@
##           master    #2611       +/-   ##
===========================================
- Coverage   73.58%   59.95%   -13.64%     
===========================================
  Files         157      157               
  Lines       15242    15210       -32     
===========================================
- Hits        11216     9119     -2097     
- Misses       4026     6091     +2065     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Tuple{CompilerJob{PTXCompilerTarget}, typeof(fn)}, job, fn)
is_intrinsic |= fn == "__nvvm_reflect"
is_intrinsic |= startswith(fn, "cuda")
is_intrinsic |= !job.config.params.link_libdevice ? startswith(fn, "__nv_") : false # Reactant.jl wants to handle __nv_ functions
Copy link
Member

Choose a reason for hiding this comment

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

This is pretty unreadable.

I also don't understand why this should be handled here. Doesn't Reactant have its own compiler job type to implement isintrinsic for? Or make sure the intrinsics are lowered before calling into GPUCompiler.jl validation?

Copy link
Contributor

Choose a reason for hiding this comment

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

No Reactant does not have a compiler job (it overlays a few functions of cuda.jl and imports from cuda.jl directly)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request needs changes Changes are needed. speculative Not sure about this one yet.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants