-
Notifications
You must be signed in to change notification settings - Fork 21
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
Support Apple Silicon #9
Conversation
@dannote could you try running |
d="$${d/llvm\/include\/llvm/llvm}" | ||
d="$${d/llvm\/include\/llvm-c/llvm-c}" | ||
d="$${d/llvm\\/include\\/llvm/llvm}" | ||
d="$${d/llvm\\/include\\/llvm-c/llvm-c}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@seanmor5 my hypothesis is that the escape in \/
would be first interpreted by Bazel and for bazel \/
would be an invalid escape. On the other hand \\
would be a valid escape and appear as \
in the actual script.
I bumped the tensorflow version as per #8 (comment). |
The escape sequences are good now, and the build succeeded. I'll try to rebuild it from scratch to be sure. |
a339774
to
b652258
Compare
All is good, thank you! |
Nitpick: |
@dannote Are you able to build EXLA with the compiled XLA package? |
We changed the cache location, so the current exla xla dependency won't pick up the build version. @dannote you can try running this in Mix.install([
{:exla, "~> 0.1.0-dev", github: "elixir-nx/nx", sparse: "exla"},
{:nx, "~> 0.1.0-dev", github: "elixir-nx/nx", sparse: "nx", override: true},
{:xla, "~> 0.1.1", github: "elixir-nx/xla", branch: "jk-m1", override: true}
], force: true)
defmodule Test do
import Nx.Defn
@defn_compiler EXLA
defn norm(x), do: Nx.dot(x, x)
end
Test.norm(Nx.tensor([1, 1])) (I will make a release shortly so the archives can build)
Ah right, thanks :) |
@seanmor5 I tried the following: diff --git a/exla/mix.exs b/exla/mix.exs
index b1eb089..419e84a 100644
--- a/exla/mix.exs
+++ b/exla/mix.exs
@@ -40,7 +40,7 @@ defmodule EXLA.MixProject do
defp deps do
[
{:nx, path: "../nx"},
- {:xla, "~> 0.1.0", runtime: false},
+ {:xla, "~> 0.1.0", runtime: false, github: "elixir-nx/xla", branch: "jk-m1"},
{:elixir_make, "~> 0.6", runtime: false},
{:benchee, "~> 1.0", only: :dev},
{:ex_doc, "~> 0.23", only: :dev}
diff --git a/exla/mix.lock b/exla/mix.lock
index 1a4fd73..7fb7ff9 100644
--- a/exla/mix.lock
+++ b/exla/mix.lock
@@ -7,5 +7,5 @@
"makeup": {:hex, :makeup, "1.0.5", "d5a830bc42c9800ce07dd97fa94669dfb93d3bf5fcf6ea7a0c67b2e0e4a7f26c
"makeup_elixir": {:hex, :makeup_elixir, "0.15.1", "b5888c880d17d1cc3e598f05cdb5b5a91b7b17ac4eaf5f297
"nimble_parsec": {:hex, :nimble_parsec, "1.1.0", "3a6fca1550363552e54c216debb6a9e95bd8d32348938e13de
- "xla": {:hex, :xla, "0.1.0", "c8ca0b6fc8442bcb96196d20e214ba7c90780d88aa33299133f66fd0786938ec", [:m
+ "xla": {:git, "https://github.com/elixir-nx/xla.git", "b65225885738478343753924b6dee684a81f61db", [b
} But it failed with: ** (Mix) failed to extract xla archive, reason: {"/Users/dannote/Library/Caches/xla/0.1.1/cache/build/xla_extension-aarch64-darwin-cpu.tar.gz", :enoent} It looks like it put the cache in the wrong location. |
@jonatanklosko Aha, I'll try once again |
Hmm, the location looks good, that's where the build should end up when you compiled on this branch. Is there anything in |
Btw. compiling inside the exla project is even better than iex actually. |
Same with ==> exla
Unpacking /Users/dannote/Library/Caches/xla/0.1.1/cache/build/xla_extension-aarch64-darwin-cpu.tar.gz into /Users/dannote/Library/Caches/mix/installs/elixir-1.12.0-erts-12.0.3/e775e5b67aef19d0dc7646c8d1a3c7b7/deps/exla/exla/cache
could not compile dependency :exla, "mix compile" failed. You can recompile this dependency with "mix deps.compile exla", update it with "mix deps.update exla" or clean it with "mix deps.clean exla"
** (Mix.Error) failed to extract xla archive, reason: {"/Users/dannote/Library/Caches/xla/0.1.1/cache/build/xla_extension-aarch64-darwin-cpu.tar.gz", :enoent}
(mix 1.12.0) lib/mix.ex:454: Mix.raise/2
/Users/dannote/Library/Caches/mix/installs/elixir-1.12.0-erts-12.0.3/e775e5b67aef19d0dc7646c8d1a3c7b7/deps/exla/exla/mix.exs:86: EXLA.MixProject.compile/1
(mix 1.12.0) lib/mix/task.ex:458: Mix.Task.run_alias/5
(mix 1.12.0) lib/mix/tasks/compile.all.ex:90: Mix.Tasks.Compile.All.run_compiler/2
(mix 1.12.0) lib/mix/tasks/compile.all.ex:70: Mix.Tasks.Compile.All.compile/4
(mix 1.12.0) lib/mix/tasks/compile.all.ex:57: Mix.Tasks.Compile.All.with_logger_app/2
(mix 1.12.0) lib/mix/tasks/compile.all.ex:35: Mix.Tasks.Compile.All.run/1
(mix 1.12.0) lib/mix/task.ex:394: anonymous fn/3 in Mix.Task.run_task/3
iex(1)> I have it in |
Ahh I see, so that's something to fix. In the meanwhile you can create |
I did: mkdir -p ~/Library/Caches/xla/cache/0.1.1/cache/build
cp ~/Library/Caches/xla/cache/build/xla_extension-aarch64-darwin-cpu.tar.gz ~/Library/Caches/xla/cache/0.1.1/cache/build Now I'm stuck at:
Maybe that's because I am on Beta. |
Looks similar to what @josevalim fixed in elixir-nx/nx#463. You can try modifying the path here: https://github.com/elixir-nx/nx/blob/9ae7b1cf8eca59fcae85d4b211637b4b966f61ca/exla/Makefile#L25 to |
@dannote i fixed the exla issue here: elixir-nx/nx@ff619a8 |
@jonatanklosko Yes, that worked. I tried the code above in
|
Absolutely beautiful!! Can you also try |
FYI it will fail without
|
Amazing, looks like bumping tensorflow is smooth this time!
Yup that's expected. We always want to reflect the current environment variables, and if XLA_BUILD is not set the behaviour is to look for a precompiled binary online (which is not available in this case). You want to I will publish the new version, so the archives can build, then we can verify it works on linux too, and then bump on the exla side! Thanks for all the help @dannote ❤️ |
Great! 🍾 Thank you, too! |
I got the following error:
I tested the file type of
|
Warnings are here:
|
@zacky1972 just to be clear, are you specifying any |
Compiling just with |
No, I was just wondering if you used any and that could be the issue :) |
I'm running this on an M1 Max: Mix.install([
{:axon, "~> 0.5.1"},
{:exla, "~> 0.5.3"},
{:nx, "~> 0.5.3"},
{:req, "~> 0.3.1"}
])
and got:
I'm having trouble understanding from the issues if my machine should be supported… |
@atomkirk is there a reason you If you indeed intend to build from source, then see this section and make sure you have the right environment, in particular the Bazel version. |
Yes it installs fine if I don't do Maybe this PR is required before it'll actually use the GPU? elixir-nx/nx#1247 |
If you mean the M1 GPU then yeah it's not supported yet, but that PR should make it happen :) |
@atomkirk when we can support metal it will just happen behind scenes, all you will need is a |
Ok, I ordered a jetson nano just now so I can keep learning. 🎉 Thanks! |
For anyone finding this via google and thinking of doing the same. The jetson nano only supports up to ubuntu 18 and xla dropped support for 18. So it's a dead end. |
See #8.