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
impureUseNativeOptimizations: add stdenv adapter #37600
Conversation
Just wondering--do you need to build all dependencies this way too? If not, a trick I've used in the past is to build a variants with different architecture assumptions (supported vector instructions, etc.). Not always possible and possibly more of a hassle but it does retain Nix purity :). |
@dtzWill No, I don't -- all the hotpath is in the emulator. I'm not sure how much of that optimization comes from specific instructions and how much from |
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.
This is clearly useful.
pkgs/stdenv/adapters.nix
Outdated
NIX_CFLAGS_COMPILE = toString (args.NIX_CFLAGS_COMPILE or "") + " -march=native"; | ||
NIX_ENFORCE_NO_NATIVE = false; | ||
}); | ||
}; |
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.
preferLocalBuild = true;
seems to be appropriate.
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.
Good idea, fixed!
This allows one to force a compiler to use native machine optimizations. This goes contrary to all the usual guarantees of Nix and so should be used only by end-user and only in specific cases when they know what are they doing. In my case this is needed to get a noticeable FPS boost in RPCS3 which is very CPU-hungry PlayStation 3 emulator.
9f9d523
to
15bfee8
Compare
ping |
I'd like to merge this in the following few days unless anyone minds. |
Motivation for this change
This allows one to force a compiler to use native machine optimizations. This
goes contrary to all the usual guarantees of Nix and so should be used only by
end-user and only in specific cases when they know what are they doing.
In my case this is needed to get a noticeable FPS boost in RPCS3 which is a very
CPU-hungry PlayStation 3 emulator.
I'm torn on whether to have this in upstream nixpkgs, hence PR.
Things done
build-use-sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)