Skip to content

Commit fba9efe

Browse files
authored
fix: get_tuple NIF helper + compilation configs and speedup (#1479)
1 parent 0cb116c commit fba9efe

File tree

4 files changed

+11
-5
lines changed

4 files changed

+11
-5
lines changed

exla/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ ifeq ($(NVCC_TEST),nvcc)
7373
NVCC := nvcc
7474
NVCCFLAGS += -DCUDA_ENABLED
7575
else
76-
NVCC := g++
76+
NVCC := $(CXX)
7777
NVCCFLAGS = $(CFLAGS)
7878
endif
7979

exla/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ mix deps.get
5959
mix test
6060
```
6161

62+
By default, EXLA passes `["-jN"]` as a Make argument, where `N` is `System.schedulers_online() - 2`, capped at `1`. `config :exla, :make_args, ...` can be used to override this default setting.
63+
6264
In order to run tests on a specific device, use the `EXLA_TARGET` environment variable, which is a dev-only variable for this project (it has no effect when using EXLA as a dependency). For example, `EXLA_TARGET=cuda` or `EXLA_TARGET=rocm`. Make sure to also specify `XLA_TARGET` to fetch or compile a proper version of the XLA binary.
6365

6466
### Building with Docker

exla/c_src/exla/exla_nif_util.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#include "exla_nif_util.h"
22

3+
#include "mlir/IR/Builders.h"
34
#include "mlir/IR/BuiltinTypes.h"
5+
#include "stablehlo/dialect/StablehloOps.h"
46
#include "xla/primitive_util.h"
57
#include "xla/shape_util.h"
6-
#include "mlir/IR/Builders.h"
7-
#include "stablehlo/dialect/StablehloOps.h"
88

99
namespace exla {
1010
namespace nif {
@@ -190,7 +190,7 @@ int get_tuple(ErlNifEnv* env, ERL_NIF_TERM tuple, std::vector<int64>& var) {
190190
var.reserve(length);
191191

192192
for (int i = 0; i < length; i++) {
193-
int data;
193+
int64 data;
194194
if (!get(env, terms[i], &data)) return 0;
195195
var.push_back(data);
196196
}

exla/mix.exs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ defmodule EXLA.MixProject do
55
@version "0.7.1"
66

77
def project do
8+
make_args =
9+
Application.get_env(:exla, :make_args) || ["-j#{max(System.schedulers_online() - 2, 1)}"]
10+
811
[
912
app: :exla,
1013
version: @version,
@@ -34,7 +37,8 @@ defmodule EXLA.MixProject do
3437
"MIX_BUILD_EMBEDDED" => "#{Mix.Project.config()[:build_embedded]}",
3538
"CWD_RELATIVE_TO_PRIV_PATH" => cwd_relative_to_priv
3639
}
37-
end
40+
end,
41+
make_args: make_args
3842
]
3943
end
4044

0 commit comments

Comments
 (0)