mach icon indicating copy to clipboard operation
mach copied to clipboard

gpu-dawn: linux aarch64 support

Open LaPingvino opened this issue 2 years ago • 7 comments

While trying to run zig build run-example on Debian ARM64 in a Chromebook Crostini VM I get:

error: gpu-dawn binaries for aarch64-linux.5.10.92...5.10.92-gnu.2.33 not available.
error: -> open an issue: https://github.com/hexops/mach/issues
error: -> build from source (takes 5-15 minutes):
error:        use -Ddawn-from-source=true or set `Options.from_source = true`

and adding -Ddawn-from-source=true to this command or trying to set from_source to true any other way doesn't fix it.

LaPingvino avatar Mar 29 '22 01:03 LaPingvino

Update: when going directly in the libs directory version of mach-gpu-dawn, it does accept the dawn-from-source option as in zig build -Ddawn-from-source=true, it's just not passed on from running the example. Now sleep, will try more later.

LaPingvino avatar Mar 29 '22 02:03 LaPingvino

Thanks for filing! I filed https://github.com/hexops/mach/issues/196 for the dawn-from-source=true bug.

Currently, aarch64-linux is not supported, I'd like to get it working soon and it shouldn't be too hard. What needs to be done:

  1. [x] Create a repository like https://github.com/hexops/sdk-linux-x86_64 but fetching aarch64 packages instead of x86_64 ones.
  2. [x] Enable use of that repo [in system_sdk.zig](https://github.com/hexops/mach/blob/a2f65d 5a231eebf1be120ba7d904675f08e1464f/glfw/system_sdk.zig#L47-L49)
  3. [ ] Make gpu-dawn/'s CI pipeline produce builds for aarch64
  4. [ ] Update gpu-dawn/build.zig to utilize those binary releases https://github.com/hexops/mach/blob/a2f65d5a231eebf1be120ba7d904675f08e1464f/gpu-dawn/build.zig#L194

slimsag avatar Mar 29 '22 08:03 slimsag

For step one: https://github.com/mitchellh/mach-sdk-linux-aarch64 Feel free to grab that and pull it into the hexops org.

mitchellh avatar Mar 30 '22 15:03 mitchellh

Fwiw, with the two steps already taken, you can now run zig build run-dawn-example -Ddawn-from-source=true in the gpu-dawn directory and this all just works on aarch64 Linux. I tested locally. Hopefully binary builds can come though :)

mitchellh avatar Mar 30 '22 18:03 mitchellh

Plan for binary builds: GitHub actions doesn't have ARM runners, but we can just cross-compile. Should be easy, I'll get this working within a few days.

slimsag avatar Mar 30 '22 18:03 slimsag

I tried but couldn't build 'run-dawn-example' from source on a Raspberry PI 400 (Ubuntu 22). I have a working zig environment there and can cross-compile simple stuff. But the Dawn build stops with a bunch of errors complaining about undefined atomics symbols:

ld.lld: error: undefined symbol: __aarch64_ldadd8_rel
> referenced by atomic:1082 (/usr/bin/lib/zig/libcxx/include/atomic:1082)

Other people have reported similar problems here: https://github.com/ziglang/zig/issues/10086#

kamidev avatar Jun 07 '22 14:06 kamidev

There is an open PR which may solve the atomics issues with linux aarch64: https://github.com/ziglang/zig/pull/11828#. Hopefully it will be merged eventually.

kamidev avatar Jun 23 '22 09:06 kamidev

In theory this probably all works now, but I don't think anyone has tested it / confirmed it does.

Getting an aarch64-linux machine to test on has been very annoying, I had bought a ROCK pi 5B for this but just last week it randomly died and I don't know why (nvme failure perhaps.)

If someone can test it works or not, that'd be helpful information in pushing support of this along.

slimsag avatar Jun 18 '23 21:06 slimsag

The way to test:

git clone https://github.com/hexops/mach
cd mach/libs/gpu
zig build run-example

slimsag avatar Jun 18 '23 21:06 slimsag

/home/ikojba/mach/libs/gpu/libs/mach-gpu-dawn/sdk.zig:225:54: error: root struct of file 'builtin' has no member named 'Version'
/home/ikojba/mach/libs/gpu/libs/mach-glfw/system_sdk.zig:46:29: error: missing struct field: patch
/home/ikojba/zig-linux-aarch64-0.11.0-dev.3704+729a051e9/lib/std/SemanticVersion.zig:1:1: note: struct declared here

Suspect that might be an issue with running on the nightly? Otherwise it doesn't show the previous issue anymore.

LaPingvino avatar Jun 19 '23 12:06 LaPingvino

added to #811

alichraghi avatar Jun 19 '23 12:06 alichraghi

with 0.10.1 I get /home/ikojba/mach/libs/gpu/build.zig:7:21: error: root struct of file 'std' has no member named 'Build'

LaPingvino avatar Jun 19 '23 12:06 LaPingvino

mach tracks master so 0.10.1 shouldn't work at all. all you have to do is changing std.builtin.Version to std.SemanticVersion in this line

-- const min_available = std.builtin.Version{ .major = 12, .minor = 0 };
++ const min_available = std.SemanticVersion{ .major = 12, .minor = 0 };

alichraghi avatar Jun 19 '23 13:06 alichraghi

Now just some "Missing struct field: .patch" errors...

LaPingvino avatar Jun 19 '23 14:06 LaPingvino

std.SemanticVersion{ .major = 12, .minor = 0, .patch = 0 };

alichraghi avatar Jun 19 '23 15:06 alichraghi

After fixing #811 this seems to work flawlessly :D

LaPingvino avatar Jun 21 '23 01:06 LaPingvino

Works as in you ran on an arm device and saw graphics?

slimsag avatar Jun 21 '23 04:06 slimsag

Yes, exactly that!

On June 21, 2023 at 4:58 GMT, Stephen Gutekanst @.***> wrote:

Works as in you ran on an arm device and saw graphics?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you modified the open/close state.Message ID: @.***>

LaPingvino avatar Jun 21 '23 10:06 LaPingvino