Tune Linux x64 prebuild for Zen 3 - #4
Merged
Merged
Conversation
ronag
marked this pull request as ready for review
July 12, 2026 11:22
There was a problem hiding this comment.
Pull request overview
This PR introduces an opt-in build-time CPU tuning switch for Linux x64 builds (via NODE_RE2_MARCH) and uses it to produce the shipped glibc linux-x64 prebuild tuned for Zen 3 (-march=znver3 -mtune=znver3), while keeping default/source builds portable when the variable is unset.
Changes:
- Add
NODE_RE2_MARCH-> GYP variable wiring and apply-march/-mtuneonly on Linux x64 when set. - Build the Docker-produced
linux/x64prebuild withNODE_RE2_MARCH=znver3. - Document the Linux x64 prebuild tuning/requirement and the source-build opt-in in the README.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| README.md | Documents the Zen 3-tuned Linux x64 prebuild and the NODE_RE2_MARCH source-build opt-in. |
| Dockerfile | Sets NODE_RE2_MARCH=znver3 for the prebuildify step to produce the shipped tuned linux-x64 artifact. |
| binding.gyp | Adds the node_re2_march variable and conditionally applies -march/-mtune on Linux x64 only when provided. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
NODE_RE2_MARCHGYP variablelinux/x64prebuild with-march=znver3 -mtune=znver3Why
The deployment x64 target is Zen 3 and should permit AVX2 optimization, matching
@nxtedition/rocksdb. The previous prebuild used the compiler's portable x64 baseline, so RE2 and Abseil could not emit AVX2 or other Zen 3 instructions.Impact
The shipped glibc
linux-x64prebuild now requires a CPU compatible with GCC'sznver3target, which includes AVX2. Linux x64 source builds remain portable by default and can opt into the same target withNODE_RE2_MARCH=znver3. The Darwin arm64 prebuild is unchanged.Validation
-marchor-mtuneflagslinux/amd64, Node 26.5.0: clean prebuild compiled and linked, then passed 14/14 prebuild-only runtime tests and TypeScript tests-march=znver3and-mtune=znver3in both C and C++ flags__AVX2__=1under the configured target; the emitted addon is a stripped 64-bit x86-64 ELF-Wrestrictwarnings from vendored Abseil appeared; there were no node-re2 warnings or errors