-
-
Notifications
You must be signed in to change notification settings - Fork 52
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
Adjust Nix infrastructure to support passing custom target CPU and -march
flags
#540
Comments
Hi! I did try to do a lot of research on what I should pick but I was having trouble finding a consistent answer on what most Raspberry Pi's supported. Sorry this broke 0.4.5 for you! I'm happy to lower it to a more reasonable level if you found one already. I see you made this knightpp@e579279 and I would accept a PR for it, but it has a ton of other formatting changes which I'd like to have split up into separate commits. |
I see. I'll try to do my own research, but I'm unsure what was the reason to change the target optimization level in the first place? The formatting changed because I use alejandra to format Nix files. I didn't intend to make a PR out of that. |
It's primarily for optimisation. conduwuit uses RocksDB, which is C, so having highly optimised bytecode makes a significant difference. We also use musl, which is slow, so any forms of optimisation also make a big difference hence things like jemalloc and io_uring are statically included in the static binaries. |
I don't know if there's a middle ground. To get the best optimizations, everyone should customize and compile for their CPU, but on my(mid 8C) machine, full cross-compilation for ARM took ~2 hours, so it's not an easy task. Another option is to add multiple CPU targets to the CI, though it won't reuse previous caches. I'll continue building it for myself, but leave this issue open. However, there's room for improvement. It would be great to add documentation on how to cross-compile and improve Nix to be able to pass target CPU. FIY: How to list CPU features
rustc --target aarch64-unknown-linux-musl -C target-cpu=cortex-a55 --print cfg |
I don't really know Nix to be able to add something like this, this will be something the community has to contribute unless I do manage to figure out (not this week). As for cross-compilation documentation using Nix, I can work on that. I did decide to just drop it down to ARMv8-A which I will merge/add soon (busy this week) and depending on what the community needs, I can figure out multiple target arch builds in CI. Though I don't think we'll run into this issue that much. I haven't produced (or even tested) ARM 32-bit builds and no one's really mentioned a need for them. |
I meant to pass optimization level as a string to Nix functions, because right now it is hardcoded into |
-march
flags
Going to change this to a feature request for the requested Nix infrastructure as I've dropped the target CPU to ARMv8-A, so next release and currently main should be "fixed". |
With 649e9da and release of v0.4.5 I can no longer run aarch64 executables and OCI images from the release page.
Even Raspberry 4 does not support Arm8.2, so this change limits self-hosting capabilities. Consider targeting something like a53 or producing artifacts for multiple optimization levels.
The text was updated successfully, but these errors were encountered: