-
Notifications
You must be signed in to change notification settings - Fork 30k
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,src: fix Intel VTune profiling support #39374
Conversation
I'm fairly sure we had this before, but it was removed because it wasn't maintained and broke. cc @nodejs/diagnostics @nodejs/v8-update |
There will have to be an update to https://github.com/nodejs/node-core-utils/blob/main/lib/update-v8/constants.js for |
Add ittapi to the list of V8 dependencies, which is used by VTune JIT profiling. Refs: nodejs/node#39374
Add ittapi to the list of V8 dependencies, which is used by VTune JIT profiling. Refs: nodejs/node#39374
ead70c9
to
2872be9
Compare
I wanted to try on my mac...
|
Thanks for looking at this change! This doc provides an example of profiling JIT-compiled JavaScript on x64/ia32 platform. |
So... I confirm that it compiles and runs fine on x64 architecture. Only one test fails:
Is it expected that this feature disables code cache in V8? |
@fanchenkong1 did you fetch the version of Line 299 in cfb7c4f
|
No, the version in V8 is earlier. Shall I update the ittapi here with the same version in V8? |
I'd say yes, because next time we update V8, it will downgrade it anyway. |
2872be9
to
7bd7b39
Compare
Thanks for the suggestion! The version of ittapi is updated to align with V8 in the latest change. BTW, I look into the test failure on code-cache a little bit. It seems that I can only reproduce this failure on Windows platform. And the failure seems not to disappear on the release build of main branch. Would you please help provide more information about your test? |
I just did the following on Linux with this branch:
|
Thanks for your help! Here are some updates for the failure in test-code-cache.js. We have found that the reuse of code cache failed at the sanity check (https://source.chromium.org/chromium/chromium/src/+/main:v8/src/snapshot/code-serializer.cc;l=305?q=code-serializer.cc&ss=chromium) with the reason SanityCheckResult::FLAGS_MISMATCH. And this failure seems to be avoided by a following change in V8.
I'm currently not sure why setting the flag at GetVtuneCodeEventHandler may cause this flag mismatch in node. Further investigation on this issue is in progress. Any insight would be helpful. |
BTW, I also found the same issue on code cache by setting various v8 runtime flags from command line. For example, but with I'm not sure. But it doesn't seem to be an ideal behaviour of code cache? |
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.
Changes to src
are minimal, LGTM
Thanks for investigating this! In any case, it's a V8 issue and shouldn't block this PR. |
@@ -0,0 +1,65 @@ | |||
The GNU General Public License (GPL) |
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.
Do we need to include this file ? Since there is the option to distribute under the BSD or GPL licence I think we'd be opting for BSD and could not want to include this one as it could be flagged by licence scanners?
# Contact Information: | ||
# http://software.intel.com/en-us/articles/intel-vtune-amplifier-xe/ | ||
# | ||
# BSD LICENSE |
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.
I think we need an addition to https://github.com/nodejs/node/blob/master/LICENSE which says that ittapi is licenced under BSD.
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.
Do we need to add it to the main LICENSE even if we don't distribute any Node.js release with this dependency?
There are some failures in the CI. The node-test-commit-windows-fanned and node-test-linux-linked-openssl111 failed on
which is mentioned in this issue. The node-test-linux-linked-openssl300 failed on
As this change won't take effect without the build time configuration '--enable-vtune-profiling', shall I expect that there is no need to have a fix for those failures from this PR? |
@fanchenkong1 yeah, unfortunately our CI is a bit unreliable at the moment. I've triggered a rerun of the failing jobs. |
7bd7b39
to
4a45d7a
Compare
@targos This change is rebased and the ittapi is updated to version 3.18.13 to meet the latest change in V8. Is there any plan on merging this pr? |
This change fix the Intel Vtune profiling support for JITted JavaScript on IA32 / X64 / X32 platform. The advantage of this profiling is that the user / developer of NodeJS application can get the detailed profiling information for every line of the JavaScript source code. This information will be very useful for the owner to optimize their applications. This feature is a compile-time option. For windows platform, the user needs to pass the following parameter to vcbuild.bat: "enable-vtune" For other OS, the user needs to pass the following parameter to ./configure command: "--enable-vtune-profiling" Fixes: nodejs#29060
@fanchenkong1 there are a few open questions about the licence above. Can you take a look/comment on those? |
@mhdawson, thanks for the reminder and sorry for the late response. The latest commit updated the license file with ittapi/LICENSES/BSD-3-Clause.txt. PATL, thanks! |
0d4472e
to
71f9905
Compare
Looks like we already had dual licenced references in @brianwarner do you have any concerns on the licence front or how to best handle/include dual licenced code to minimize what those do who licence scans have to do? |
is this RP merged? |
Superseded by #45248 |
Pull Request check-list
Please make sure to review and check all of these items:
Affected core subsystem(s)
No effected core subsystem.
Description of change
This change fix the Intel Vtune profiling support for JITted
JavaScript on IA32 / X64 / X32 platform. The advantage of this profiling
is that the user / developer of NodeJS application can get the detailed
profiling information for every line of the JavaScript source code.
This information will be very useful for the owner to optimize their
applications.
This feature is a compile-time option. For windows platform, the user
needs to pass the following parameter to vcbuild.bat: "enable-vtune"
For other OS, the user needs to pass the following parameter to
./configure command: "--enable-vtune-profiling"
Fixes: #29060