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

feat(exla): take advantage of the new LU impl #1590

Merged
merged 1 commit into from
Mar 6, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 8 additions & 14 deletions exla/lib/exla/defn.ex
Original file line number Diff line number Diff line change
Expand Up @@ -546,21 +546,15 @@ defmodule EXLA.Defn do

defp cached_recur_operator(
:lu,
%T{data: %Expr{args: [{p_expr, l_expr, u_expr}, tensor, _opts]}},
state,
%T{
data: %Expr{args: [{p_expr, l_expr, u_expr}, %{type: {type_kind, _}} = tensor, _opts]}
},
%{client: %{platform: :host}} = state,
cache
) do
%{type: {p_type_kind, _}} = p_expr
%{type: {out_type_kind, _}} = l_expr

if state.client.platform != :host do
raise ArgumentError, "XLA does not currently support the LU operation on non-host devices"
end

if p_type_kind == :c or out_type_kind == :c do
raise ArgumentError, "XLA does not currently support the LU operation for complex inputs"
end

)
when type_kind != :c do
# We only want to accelerate the LU operation for real inputs on the host device.
# Otherwise, we use the default implementation in Nx.
{tensor, cache} = recur_operator(tensor, state, cache) |> unwrap_single_tensor!()

tensor =
Expand Down
Loading