Skip to content
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

build: add support for section ordering #35272

Conversation

gabrielschulhof
Copy link
Contributor

Adds support for using a section ordering file with the gold linker.
This makes it possible to reorder functions in a build to optimize for
a specific workload.

hfsort is a tool that can be used to generate such a file from perf-
recorded LBR data by running Node.js as node --perf-basic-prof.

Refs: https://github.com/facebook/hhvm/tree/9966d482c19c6120c621c6f3896525fb19fb3842/hphp/tools/hfsort
Refs: https://software.intel.com/content/www/us/en/develop/articles/runtime-optimization-blueprint-IA-optimization-with-last-branch-record.html
Refs: #16891
Signed-off-by: @gabrielschulhof

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • documentation is changed or added
  • commit message follows commit guidelines

@nodejs-github-bot nodejs-github-bot added the build Issues and PRs related to build files or the CI. label Sep 19, 2020
common.gypi Outdated
@@ -172,6 +172,16 @@
},
'cflags': [ '-O3' ],
'conditions': [
['node_section_ordering_file!="-"', {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since common.gypi is also used to compile addons any variables referenced needs to have default values so addons can be compiled with older versions of Node.js where the variable isn’t present. See #33688 for an example.

configure.py Show resolved Hide resolved
configure.py Outdated
o['variables']['node_section_ordering_file'] = os.path.realpath(
str(options.node_section_ordering_file))
else:
# An empty string here will cause gyp to fail.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's because gyp handles variables ending in _file (and _dir and _path) specially. Rename it and it should work without this workaround.

Adds support for using a section ordering file with the gold linker.
This makes it possible to reorder functions in a build to optimize for
a specific workload.

`hfsort` is a tool that can be used to generate such a file from perf-
recorded last branch record (LBR) data by running Node.js as
`node --perf-basic-prof`.

Refs: https://github.com/facebook/hhvm/tree/9966d482c19c6120c621c6f3896525fb19fb3842/hphp/tools/hfsort
Refs: https://software.intel.com/content/www/us/en/develop/articles/runtime-optimization-blueprint-IA-optimization-with-last-branch-record.html
Refs: nodejs#16891
Signed-off-by: Gabriel Schulhof <gabriel.schulhof@intel.com>
@gabrielschulhof
Copy link
Contributor Author

@richardlau @cclaus @bnoordhuis I addressed your review comments. Please take another look!

@gabrielschulhof gabrielschulhof added the request-ci Add this label to start a Jenkins CI on a PR. label Sep 29, 2020
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Sep 29, 2020
@nodejs-github-bot
Copy link
Collaborator

@gabrielschulhof gabrielschulhof added the commit-queue Add this label to land a pull request using GitHub Actions. label Sep 30, 2020
@github-actions github-actions bot added commit-queue-failed An error occurred while landing this pull request using GitHub Actions. and removed commit-queue Add this label to land a pull request using GitHub Actions. labels Sep 30, 2020
gabrielschulhof pushed a commit that referenced this pull request Sep 30, 2020
Adds support for using a section ordering file with the gold linker.
This makes it possible to reorder functions in a build to optimize for
a specific workload.

`hfsort` is a tool that can be used to generate such a file from perf-
recorded last branch record (LBR) data by running Node.js as
`node --perf-basic-prof`.

Refs: https://github.com/facebook/hhvm/tree/9966d482c19c6120c621c6f3896525fb19fb3842/hphp/tools/hfsort
Refs: https://software.intel.com/content/www/us/en/develop/articles/runtime-optimization-blueprint-IA-optimization-with-last-branch-record.html
Refs: #16891
Signed-off-by: Gabriel Schulhof <gabriel.schulhof@intel.com>
PR-URL: #35272
Reviewed-By: Christian Clauss <cclauss@me.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
@gabrielschulhof
Copy link
Contributor Author

Landed in 869ded3.

danielleadams pushed a commit that referenced this pull request Oct 6, 2020
Adds support for using a section ordering file with the gold linker.
This makes it possible to reorder functions in a build to optimize for
a specific workload.

`hfsort` is a tool that can be used to generate such a file from perf-
recorded last branch record (LBR) data by running Node.js as
`node --perf-basic-prof`.

Refs: https://github.com/facebook/hhvm/tree/9966d482c19c6120c621c6f3896525fb19fb3842/hphp/tools/hfsort
Refs: https://software.intel.com/content/www/us/en/develop/articles/runtime-optimization-blueprint-IA-optimization-with-last-branch-record.html
Refs: #16891
Signed-off-by: Gabriel Schulhof <gabriel.schulhof@intel.com>
PR-URL: #35272
Reviewed-By: Christian Clauss <cclauss@me.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
@danielleadams danielleadams mentioned this pull request Oct 6, 2020
joesepi pushed a commit to joesepi/node that referenced this pull request Jan 8, 2021
Adds support for using a section ordering file with the gold linker.
This makes it possible to reorder functions in a build to optimize for
a specific workload.

`hfsort` is a tool that can be used to generate such a file from perf-
recorded last branch record (LBR) data by running Node.js as
`node --perf-basic-prof`.

Refs: https://github.com/facebook/hhvm/tree/9966d482c19c6120c621c6f3896525fb19fb3842/hphp/tools/hfsort
Refs: https://software.intel.com/content/www/us/en/develop/articles/runtime-optimization-blueprint-IA-optimization-with-last-branch-record.html
Refs: nodejs#16891
Signed-off-by: Gabriel Schulhof <gabriel.schulhof@intel.com>
PR-URL: nodejs#35272
Reviewed-By: Christian Clauss <cclauss@me.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
@gabrielschulhof gabrielschulhof deleted the use-section-ordering-file2 branch January 28, 2021 00:14
@gabrielschulhof gabrielschulhof restored the use-section-ordering-file2 branch January 28, 2021 05:33
@gabrielschulhof gabrielschulhof deleted the use-section-ordering-file2 branch February 3, 2021 07:17
@targos targos removed the commit-queue-failed An error occurred while landing this pull request using GitHub Actions. label Sep 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Issues and PRs related to build files or the CI.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants