mach
mach copied to clipboard
gpu-dawn: linux aarch64 support
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.
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.
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:
- [x] Create a repository like https://github.com/hexops/sdk-linux-x86_64 but fetching aarch64 packages instead of x86_64 ones.
- [x] Enable use of that repo [in system_sdk.zig](https://github.com/hexops/mach/blob/a2f65d 5a231eebf1be120ba7d904675f08e1464f/glfw/system_sdk.zig#L47-L49)
- [ ] Make gpu-dawn/'s CI pipeline produce builds for aarch64
- [ ] Update
gpu-dawn/build.zig
to utilize those binary releases https://github.com/hexops/mach/blob/a2f65d5a231eebf1be120ba7d904675f08e1464f/gpu-dawn/build.zig#L194
For step one: https://github.com/mitchellh/mach-sdk-linux-aarch64 Feel free to grab that and pull it into the hexops
org.
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 :)
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.
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#
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.
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.
The way to test:
git clone https://github.com/hexops/mach
cd mach/libs/gpu
zig build run-example
/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.
added to #811
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'
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 };
Now just some "Missing struct field: .patch" errors...
std.SemanticVersion{ .major = 12, .minor = 0, .patch = 0 };
After fixing #811 this seems to work flawlessly :D
Works as in you ran on an arm device and saw graphics?
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: @.***>