-
Notifications
You must be signed in to change notification settings - Fork 42
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 back support for optimizing a single function #435
Comments
add!(mpm, NewPMFunctionPassManager()) do fpm
add!(fpm, "function-pass")
end You'll have to clarify what exactly it is you're missing.
Upstream has decided that the string interface is the way to go, without exposing the guts of the pass manager, so I'm not inclined to do this. |
at minimum I can't presently run the Julia pass pipeline in
|
In discussion with @gbaraldi I think this also presently breaks https://github.com/JuliaLang/AllocCheck.jl |
Yeah, that function isn't used/supported anymore. You can run the Julia pipeline by simply using LLVM.jl 8.0 was a breaking release for exactly that reason. Downstream users need to be updated to the new PM wrappers, which now match LLVM's upstream design instead of rolling our own. |
That function doesn’t have the same level of options we need to just run
particular parts of the pipeline (which are available in the other fn).
…On Tue, Aug 6, 2024 at 11:49 AM Tim Besard ***@***.***> wrote:
at minimum I can't presently run the Julia pass pipeline in
@CCall jl_build_newpm_pipeline(mpm.ref::Ptr{Cvoid}, pb.ref::Ptr{Cvoid},
config::Ptr{PipelineConfig})::Cvoid
Yeah, that function isn't used/supported anymore. You can run the Julia
pipeline by simply using run("julia"):
https://github.com/maleadt/LLVM.jl/blob/ed30abdaf2bf26c1308585c8a89137b2a58479fa/test/newpm_tests.jl#L220-L227
—
Reply to this email directly, view it on GitHub
<#435 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAJTUXGGL6TT3K7EOS4LYR3ZQDV7PAVCNFSM6AAAAABL7CAKUCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENZRGYYTEMRZGA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
In particular the previous function had options for [which we added to julia itself (https://github.com/JuliaLang/julia/pull/52544/files) as we used] struct PipelineConfig
Speedup::Cint
Size::Cint
lower_intrinsics::Cint
dump_native::Cint
external_use::Cint
llvm_only::Cint
always_inline::Cint
enable_early_simplifications::Cint
enable_early_optimizations::Cint
enable_scalar_optimizations::Cint
enable_loop_optimizations::Cint
enable_vector_pipeline::Cint
remove_ni::Cint
cleanup::Cint
end |
I think that's a Julia "bug", where the string-based pipeline configurability isn't the same as the What other options do you need? I'm not entirely sure this is the intended/best design though, as upstream also uses |
So essentially we need to run individual parts of the julia pipeline, and not its whole thing. Hence the options above let us disable all the pipeline except individual pieces |
So you want the The GPUCompiler.jl optim pipeline with |
We do, but it's presently in the OldPM for reasons of other non-julia passes. Trying to shim newpm passes into the oldpm is where we hit the problem at hand. |
I'm not sure what you mean by that. It may be relevant how GPUCompiler.jl did something like that before requiring NewPM: https://github.com/JuliaGPU/GPUCompiler.jl/pull/591/files#diff-5704fd743c05cadd3686d40b99332cdf0bd505e8186d37679496024d1dc5bfc3R651 All that said, can you please try to file more actionable issues? "Restore the old functionality" is not an productive ask, and "there is no longer a way to run function passes in the new PM" as the issue summary is just not true. I'm happy to help provide whatever functionality Enzyme.jl needs, but it's entirely unclear to me what you need. |
Yeah sorry about that, I should've marked this as a question and/or discussion rather than issue as I try to figure out how to update things to LLVM8/1.11. My original ask was restoring the ModulePass/AnalysisManager constructor/destructor functions in the jll for us to be able to use And my original issue was I didn't see a way in LLVM.jl to run new pass manager passes on a single function [in contrast to an entire module]. As for the first issue, @gbaraldi concurrently suggested your idea of upstreaming the config change into Julia, which I think would solve issues I'm hitting there. As for the second issue, I think I can work around things by forcing a bunch of function passes to become module passes, but it's still a bit odd. In essence, the shim I had earlier was something like the following to run some newpm code in the old pm: function propagate_julia_addrsp_tm!(pm, tm)
function prop_julia_addr(f)
@dispose pb=NewPMPassBuilder() begin
fpm = NewPMFunctionPassManager()
add!(fpm, PropagateJuliaAddrspacesPass())
run!(pb, fpm, f, tm)
end
return true
end
add!(pm, FunctionPass("PropagateJuliaAddrSpace", prop_julia_addr))
end Now I think this works by changing it to be a module pass, which is fine. I'm a bit unclear on alias analysis though since I don't think those are currently registered now in the NewPM |
Ah yes, that's indeed a missing feature. We could probably generalize |
Since the NewPM api's were changed, there is no longer a way to run function passes in the new PM.
This is breaking Enzyme's ability to work in 1.11 at the moment.
I started working around this here: EnzymeAD/Enzyme.jl#1699
but now finally I'm hitting a lack of NewPM related functions which were stripped out of LibLLVMExtra
Can this functionality [at least in jll] be restored?
The text was updated successfully, but these errors were encountered: