-
Notifications
You must be signed in to change notification settings - Fork 69
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
Add tape type mechanisms with parent_job capability #734
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## main #734 +/- ##
==========================================
- Coverage 77.34% 77.08% -0.26%
==========================================
Files 18 18
Lines 7377 7407 +30
==========================================
+ Hits 5706 5710 +4
- Misses 1671 1697 +26 ☔ View full report in Codecov by Sentry. |
@@ -2774,8 +2778,8 @@ end | |||
subfunc = nothing | |||
if mode == API.DEM_ForwardMode | |||
if fwdmodenm === nothing | |||
etarget = Compiler.EnzymeTarget() | |||
eparams = Compiler.EnzymeCompilerParams(Tuple{(dupClosure ? Duplicated : Const){funcT}, e_tt.parameters...}, API.DEM_ForwardMode, width, Const{Nothing}, #=runEnzyme=#true, #=abiwrap=#true, modifiedBetween, #=returnPrimal=#false, #=shadowInit=#false, UnknownTapeType) | |||
etarget = Compiler.EnzymeTarget(job.config.target.parent_target) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
etarget = Compiler.EnzymeTarget(job.config.target.parent_target) | |
etarget = job.config.target |
@@ -6197,10 +6200,25 @@ end | |||
|
|||
# Define EnzymeTarget | |||
Base.@kwdef struct EnzymeTarget <: AbstractCompilerTarget | |||
parent_target::Union{Nothing, AbstractCompilerTarget} | |||
end | |||
GPUCompiler.llvm_triple(T::EnzymeTarget) = Sys.MACHINE ? T.parent_target === nothing : GPUCompiler.llvm_triple(T.parent_target) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GPUCompiler.llvm_triple(T::EnzymeTarget) = Sys.MACHINE ? T.parent_target === nothing : GPUCompiler.llvm_triple(T.parent_target) | |
GPUCompiler.llvm_triple(T::EnzymeTarget) = T.parent_target === nothing ? Sys.MACHINE : GPUCompiler.llvm_triple(T.parent_target) |
|
||
function GPUCompiler.process_module!(@nospecialize(job::CompilerJob{EnzymeTarget}), mod::LLVM.Module) | ||
if job.target.parent_target !== nothing | ||
# process_module!(similar(job, job.target.parent_target), mod) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That should be correct?
@@ -8782,8 +8805,8 @@ import GPUCompiler: deferred_codegen_jobs | |||
@generated function deferred_codegen(::Val{World}, ::Type{FA}, ::Val{tt}, ::Val{rt},::Val{Mode}, | |||
::Val{width}, ::Val{ModifiedBetween}, ::Val{ReturnPrimal}=Val(false),::Val{ShadowInit}=Val(false),::Type{ExpectedTapeType}=UnknownTapeType) where {World, FA<:Annotation,tt, rt, Mode, width, ModifiedBetween, ReturnPrimal, ShadowInit,ExpectedTapeType} | |||
mi = fspec(eltype(FA), tt, World) | |||
target = EnzymeTarget() | |||
params = EnzymeCompilerParams(Tuple{FA, tt.parameters...}, Mode, width, remove_innerty(rt), true, #=abiwrap=#true, ModifiedBetween, ReturnPrimal, ShadowInit,ExpectedTapeType) | |||
target = EnzymeTarget(nothing) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make this NativeTarget
then we don't need to worry about nothing vs defined?
etarget = Compiler.EnzymeTarget() | ||
eparams = Compiler.EnzymeCompilerParams(Tuple{(dupClosure ? Duplicated : Const){funcT}, e_tt.parameters...}, API.DEM_ForwardMode, width, Const{Nothing}, #=runEnzyme=#true, #=abiwrap=#true, modifiedBetween, #=returnPrimal=#false, #=shadowInit=#false, UnknownTapeType) | ||
etarget = Compiler.EnzymeTarget(job.config.target.parent_target) | ||
eparams = Compiler.EnzymeCompilerParams(Tuple{(dupClosure ? Duplicated : Const){funcT}, e_tt.parameters...}, API.DEM_ForwardMode, width, Const{Nothing}, #=runEnzyme=#true, #=abiwrap=#true, modifiedBetween, #=returnPrimal=#false, #=shadowInit=#false, UnknownTapeType, GPUCompiler.method_table(job)) | ||
ejob = Compiler.CompilerJob(mi2, CompilerConfig(etarget, eparams; kernel=false), world) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Btw there is a copy-constructor https://github.com/JuliaGPU/GPUCompiler.jl/blob/d5086fb3d93bbc4795a96f6f1457898af46a24cb/src/interface.jl#L111-L115
Rebase after #1104 ? there still seems to be some useful things in here. |
Superceeded by present functionality |
hm @vchuravy you're right maybe there is something still useful here |
No description provided.