Skip to content

feat: Nx.elixir_call/3 #1627

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

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

feat: Nx.elixir_call/3 #1627

wants to merge 5 commits into from

Conversation

polvalente
Copy link
Contributor

Allows calling Elixir functions inside defn expressions.

Currently limited to Nx.Defn.Evaluator. EXLA will be able to support this in a future PR by making use of Nx.Defn.Graph, splitting the expression before and after the elixir_call node, creating an isolated stage for the elixir call.

@josevalim
Copy link
Collaborator

Great! Although I'm not sure if it elixir_call is the best name? It also seems this relates to optional callbacks somehow? For example, optional callbacks require a default implementation in Elixir to be given, so they have similar dispatch mechanisms. On the other hand, we may also want to allow what is defined as an Elixir call to go through grad or be optimised in EXLA. So I'm thinking there is an overall unified mechanism where they are specified the same, but the compiler decides if it is a split or compiled, based on its structure at compile time. Glad to chat about it later!

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