Skip to content

Commit

Permalink
feat: add config for compiler mode (#1449)
Browse files Browse the repository at this point in the history
  • Loading branch information
polvalente authored Feb 20, 2024
1 parent 321c711 commit bead39c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions exla/lib/exla.ex
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,17 @@ defmodule EXLA do
* `:highest` - Slowest but most accurate. Performs computations in float32
or float64 as applicable
* `:compiler_mode` - the mode to use for the compiler. It must be one of:
* `:mlir` - The default mode. Uses MLIR to compile the computation
* `:xla` - Legacy implementation. Uses XLA to compile the computation
The `:compiler_mode` can also be set globally through a specific fallback config:
config :exla, :compiler_mode, :mlir
## Clients
The `EXLA` library uses a client for compiling and executing code.
Expand Down
2 changes: 1 addition & 1 deletion exla/lib/exla/defn.ex
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ defmodule EXLA.Defn do

inputs_and_shapes = Enum.reverse(reverse_inputs_and_shapes)

mode = options[:compiler_mode] || :xla
mode = options[:compiler_mode] || Application.get_env(:exla, :compiler_mode, :mlir)

{mod, builder} =
case mode do
Expand Down

0 comments on commit bead39c

Please sign in to comment.