Conversation
Contributor
|
Your PR requires formatting changes to meet the project's style guidelines. Click here to view the suggested changes.diff --git a/src/compiler.jl b/src/compiler.jl
index d25ddc22..ce7f9969 100644
--- a/src/compiler.jl
+++ b/src/compiler.jl
@@ -1080,15 +1080,15 @@ end
EnumAttribute("willreturn"),
EnumAttribute("nosync"),
EnumAttribute("nofree"),
- StringAttribute("enzyme_preserve_primal", "*"),
+ StringAttribute("enzyme_preserve_primal", "*"),
]
else
LLVM.Attribute[EnumAttribute("memory", NoEffects.data), StringAttribute("enzyme_shouldrecompute"),
EnumAttribute("willreturn"),
EnumAttribute("nosync"),
- EnumAttribute("nofree"),
- StringAttribute("enzyme_preserve_primal", "*"),
- ]
+ EnumAttribute("nofree"),
+ StringAttribute("enzyme_preserve_primal", "*"),
+ ]
end
handleCustom(state, custom, k_name, llvmfn, name, attrs)
return
@@ -6765,11 +6765,11 @@ function _thunk(job, postopt::Bool = true)::Tuple{LLVM.Module, Vector{Any}, Stri
for f in functions(mod)
for i in 1:length(parameters(f))
for a in collect(parameter_attributes(f, i))
- if kind(a) == "enzyme_sret"
- API.EnzymeDumpValueRef(f)
- end
- @assert kind(a) != "enzyme_sret"
- @assert kind(a) != "enzyme_sret_v"
+ if kind(a) == "enzyme_sret"
+ API.EnzymeDumpValueRef(f)
+ end
+ @assert kind(a) != "enzyme_sret"
+ @assert kind(a) != "enzyme_sret_v"
end
end
end
@@ -6779,7 +6779,7 @@ function _thunk(job, postopt::Bool = true)::Tuple{LLVM.Module, Vector{Any}, Stri
if DumpPrePostOpt[]
API.EnzymeDumpModuleRef(mod.ref)
end
- post_optimize!(mod, JIT.get_tm(); callconv=false)
+ post_optimize!(mod, JIT.get_tm(); callconv = false)
if DumpPostOpt[]
API.EnzymeDumpModuleRef(mod.ref)
end
diff --git a/src/compiler/optimize.jl b/src/compiler/optimize.jl
index ec2e8d34..6fbe8b6b 100644
--- a/src/compiler/optimize.jl
+++ b/src/compiler/optimize.jl
@@ -392,7 +392,7 @@ const DumpPostCallConv = Ref(false)
function fixup_callconv!(mod::LLVM.Module, tm::LLVM.TargetMachine)
addr13NoAlias(mod)
- removeDeadArgs!(mod, tm, #=post_gc_fixup=#false)
+ removeDeadArgs!(mod, tm, #=post_gc_fixup=# false)
memcpy_sret_split!(mod)
# if we did the move_sret_tofrom_roots, we will have loaded out of the sret, then stored into the rooted.
@@ -448,17 +448,17 @@ function post_optimize!(mod::LLVM.Module, tm::LLVM.TargetMachine, machine::Bool
if callconv
fixup_callconv!(mod, tm)
end
-
+
for f in functions(mod)
- if isempty(blocks(f))
- continue
- end
- if has_fn_attr(f, StringAttribute("enzyme_preserve_primal"))
- delete!(LLVM.function_attributes(f), StringAttribute("enzyme_preserve_primal"))
- end
+ if isempty(blocks(f))
+ continue
+ end
+ if has_fn_attr(f, StringAttribute("enzyme_preserve_primal"))
+ delete!(LLVM.function_attributes(f), StringAttribute("enzyme_preserve_primal"))
+ end
end
- removeDeadArgs!(mod, tm, #=post_gc_fixup=#true)
+ removeDeadArgs!(mod, tm, #=post_gc_fixup=# true)
@dispose pb = NewPMPassBuilder() begin
registerEnzymeAndPassPipeline!(pb)
diff --git a/src/llvm/transforms.jl b/src/llvm/transforms.jl
index 5d488bb9..ec7c12db 100644
--- a/src/llvm/transforms.jl
+++ b/src/llvm/transforms.jl
@@ -2619,16 +2619,16 @@ function removeDeadArgs!(mod::LLVM.Module, tm::LLVM.TargetMachine, post_gc_fixup
)
for u in LLVM.uses(fn)
u = LLVM.user(u)
- if !isa(u, LLVM.CallInst)
- # TODO investigate if the inttoptr store that comes from reference caller poses an issue.
- continue
- msg = sprint() do io
- println(io, "Unknown user of fn: ", string(u))
- println(io, "fn: ", string(fn))
- println(io, "mod: ", string(LLVM.parent(fn)))
- end
- throw(AssertionError(msg))
- end
+ if !isa(u, LLVM.CallInst)
+ # TODO investigate if the inttoptr store that comes from reference caller poses an issue.
+ continue
+ msg = sprint() do io
+ println(io, "Unknown user of fn: ", string(u))
+ println(io, "fn: ", string(fn))
+ println(io, "mod: ", string(LLVM.parent(fn)))
+ end
+ throw(AssertionError(msg))
+ end
B = IRBuilder()
nextInst = LLVM.Instruction(LLVM.API.LLVMGetNextInstruction(u))
position!(B, nextInst)
@@ -2665,26 +2665,26 @@ function removeDeadArgs!(mod::LLVM.Module, tm::LLVM.TargetMachine, post_gc_fixup
for u in LLVM.uses(fn)
u = LLVM.user(u)
if isa(u, LLVM.ConstantExpr)
- for u in LLVM.uses(u)
- u = LLVM.user(u)
- if !isa(u, LLVM.CallInst)
- continue
- end
- @assert isa(u, LLVM.CallInst)
- B = IRBuilder()
- nextInst = LLVM.Instruction(LLVM.API.LLVMGetNextInstruction(u))
- position!(B, nextInst)
- inp = operands(u)[idx]
- cl = call!(B, funcT, sfunc, LLVM.Value[inp])
- if isa(value_type(inp), LLVM.PointerType)
- LLVM.API.LLVMAddCallSiteAttribute(
- cl,
- LLVM.API.LLVMAttributeIndex(1),
- EnumAttribute("nocapture"),
- )
- end
- end
- continue
+ for u in LLVM.uses(u)
+ u = LLVM.user(u)
+ if !isa(u, LLVM.CallInst)
+ continue
+ end
+ @assert isa(u, LLVM.CallInst)
+ B = IRBuilder()
+ nextInst = LLVM.Instruction(LLVM.API.LLVMGetNextInstruction(u))
+ position!(B, nextInst)
+ inp = operands(u)[idx]
+ cl = call!(B, funcT, sfunc, LLVM.Value[inp])
+ if isa(value_type(inp), LLVM.PointerType)
+ LLVM.API.LLVMAddCallSiteAttribute(
+ cl,
+ LLVM.API.LLVMAttributeIndex(1),
+ EnumAttribute("nocapture"),
+ )
+ end
+ end
+ continue
end
if !isa(u, LLVM.CallInst)
continue |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2824 +/- ##
==========================================
- Coverage 66.88% 66.78% -0.11%
==========================================
Files 58 58
Lines 21315 21356 +41
==========================================
+ Hits 14257 14262 +5
- Misses 7058 7094 +36 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Contributor
Benchmark Results
Benchmark PlotsA plot of the benchmark results has been uploaded as an artifact at https://github.com/EnzymeAD/Enzyme.jl/actions/runs/21129099509/artifacts/5173734216. |
91a652f to
e6b5c3a
Compare
Member
Author
|
@copilot isolate a MWE of whatever test is timing out |
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
requires EnzymeAD/Enzyme#2592