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

Add tape type mechanisms with parent_job capability #734

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Conversation

wsmoses
Copy link
Member

@wsmoses wsmoses commented Apr 16, 2023

No description provided.

@wsmoses wsmoses requested a review from vchuravy April 16, 2023 15:20
@codecov-commenter
Copy link

codecov-commenter commented Apr 17, 2023

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 48.07692% with 27 lines in your changes missing coverage. Please review.

Project coverage is 77.08%. Comparing base (28696a0) to head (9178424).
Report is 742 commits behind head on main.

Files with missing lines Patch % Lines
src/Enzyme.jl 0.00% 18 Missing ⚠️
src/compiler.jl 70.00% 9 Missing ⚠️

❗ 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.
📢 Have feedback on the report? Share it here.

@vchuravy vchuravy requested a review from ZuseZ4 April 17, 2023 17:24
@@ -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)
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
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)
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
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)
Copy link
Member

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)
Copy link
Member

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)
Copy link
Member

Choose a reason for hiding this comment

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

@vchuravy
Copy link
Member

vchuravy commented Apr 1, 2024

Rebase after #1104 ? there still seems to be some useful things in here.

@wsmoses
Copy link
Member Author

wsmoses commented May 11, 2024

Superceeded by present functionality

@wsmoses wsmoses closed this May 11, 2024
@wsmoses wsmoses deleted the tapety branch May 11, 2024 22:46
@wsmoses wsmoses restored the tapety branch May 11, 2024 22:46
@wsmoses wsmoses reopened this May 11, 2024
@wsmoses
Copy link
Member Author

wsmoses commented May 11, 2024

hm @vchuravy you're right maybe there is something still useful here

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