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 external packages to influence global load inlining #669

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

wsmoses
Copy link
Member

@wsmoses wsmoses commented Mar 11, 2023

E.g. the following is required to get past the ref inside MPI.SUM.

Similar analogues may be needed for cuda/etc API's, if handled within Enzyme rather than a high-level rule.

using MPI
using Enzyme
using EnzymeCore

Enzyme.API.printall!(true)
push!(EnzymeCore.GlobalInlinedLoads, MPI.SUM, MPI.DOUBLE)

function foo(x::Vector{Float64})
    MPI.Reduce!(x, MPI.SUM, 0, MPI.COMM_WORLD)
    return nothing
end

MPI.Init()

x = ones(10)
foo(x)
x = ones(10)
dx = zeros(10)
autodiff(Reverse, foo, Duplicated(x, dx))

MPI.Finalize()

see: https://github.com/EnzymeAD/Enzyme/pull/1025/files

@wsmoses wsmoses requested a review from vchuravy March 11, 2023 05:31
Copy link
Member

@vchuravy vchuravy left a comment

Choose a reason for hiding this comment

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

As discussed offline this is better implemented with a custom rule IMO.

@wsmoses wsmoses mentioned this pull request Nov 20, 2023
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.

2 participants