-
Notifications
You must be signed in to change notification settings - Fork 10.7k
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
[ORC][JITLink] Add Intel VTune support to JITLink #81826
Conversation
Thank you for submitting a Pull Request (PR) to the LLVM Project! This PR will be automatically labeled and the relevant teams will be If you wish to, you can add reviewers by using the "Reviewers" section on this page. If this is not working for you, it is probably because you do not have write If you have received no comments on your PR for a week, you can request a review If you have further questions, they may be answered by the LLVM GitHub User Guide. You can also ask questions in a comment on this PR, on the LLVM Discord or on the forums. |
You can test this locally with the following command:git-clang-format --diff bc9c6c0c65e267a1a84e4eede81099d8ceb37558 4bc5719084d7ace375e524cca2dca942e1d90f20 -- llvm/include/llvm/ExecutionEngine/Orc/Debugging/VTuneSupportPlugin.h llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/JITLoaderVTune.h llvm/lib/ExecutionEngine/Orc/Debugging/VTuneSupportPlugin.cpp llvm/lib/ExecutionEngine/Orc/TargetProcess/JITLoaderVTune.cpp llvm/tools/llvm-jitlink/llvm-jitlink.cpp View the diff from clang-format here.diff --git a/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/JITLoaderVTune.h b/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/JITLoaderVTune.h
index a9fa9967ac..8c63a9aa47 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/JITLoaderVTune.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/JITLoaderVTune.h
@@ -1,5 +1,6 @@
-//===------- JITLoaderVTune.h --- Register profiler objects ------*- C++ -*-===//
+//===------- JITLoaderVTune.h --- Register profiler objects ------*- C++
+//-*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -27,5 +28,3 @@ extern "C" llvm::orc::shared::CWrapperFunctionResult
llvm_orc_test_registerVTuneImpl(const char *Data, uint64_t Size);
#endif // LLVM_EXECUTIONENGINE_ORC_TARGETPROCESS_JITLOADERVTUNE_H
-
-
diff --git a/llvm/tools/llvm-jitlink/llvm-jitlink.cpp b/llvm/tools/llvm-jitlink/llvm-jitlink.cpp
index 0217f645a0..09b2a5900e 100644
--- a/llvm/tools/llvm-jitlink/llvm-jitlink.cpp
+++ b/llvm/tools/llvm-jitlink/llvm-jitlink.cpp
@@ -1015,9 +1015,10 @@ Session::Session(std::unique_ptr<ExecutorProcessControl> EPC, Error &Err)
if (VTuneSupport && TT.isOSBinFormatELF()) {
ObjLayer.addPlugin(ExitOnErr(DebugInfoPreservationPlugin::Create()));
- ObjLayer.addPlugin(ExitOnErr(VTuneSupportPlugin::Create(
- this->ES.getExecutorProcessControl(), *ProcessSymsJD, /*EmitDebugInfo=*/true,
- /*TestMode=*/true)));
+ ObjLayer.addPlugin(ExitOnErr(
+ VTuneSupportPlugin::Create(this->ES.getExecutorProcessControl(),
+ *ProcessSymsJD, /*EmitDebugInfo=*/true,
+ /*TestMode=*/true)));
}
// Set up the platform.
|
if (I != Deduplicator.end()) { | ||
return I->second; | ||
} |
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.
The LLVM style guide omits braces for single line statements, so this could just be:
if (I != Deduplicator.end())
return I->second;
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.
Fixed(all of them)!
auto I = LoadedMethodIDs.find(SrcKey); | ||
if (I == LoadedMethodIDs.end()) { | ||
return; | ||
} | ||
auto &Dest = LoadedMethodIDs[DstKey]; | ||
Dest.insert(Dest.end(), I->second.begin(), I->second.end()); |
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.
Should there be a LoadedMethodIDs.erase(SrcKey)
at the end to remove the stale key?
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.
Yes! I just added it. Thank you for finding it out!
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.
Thanks @yugier. This looking great -- thank you very much for working on this!
This patch adds two plugins: VTuneSupportPlugin.cpp and JITLoaderVTune.cpp. The testing is done in a manner similar to llvm-jitlistener. Currently, we only support the old version of Intel VTune API.
2e07d5d
to
4bc5719
Compare
Force push to rebase on #81825 |
@yugier Congratulations on having your first Pull Request (PR) merged into the LLVM Project! Your changes will be combined with recent changes from other authors, then tested Please check whether problems have been caused by your change specifically, as How to do this, and the rest of the post-merge process, is covered in detail here. If your change does cause a problem, it may be reverted, or you can revert it yourself. If you don't get any reports, no action is required from you. Your changes are working as expected, well done! |
Congratulations on having your first Pull Request (PR) merged into the LLVM Project! This change introduced a cyclic dependency, which appears difficult to resolve. The library dependencies look like: This is best demonstrated as a Bazel build failure
If you add a dependency
Bazel will show a cycle
|
This reverts commit 17efdad. The library dependencies look like: LLVMOrcDebugging -> LLVMOrcJIT -> LLVMOrcTargetProcess. `#include "llvm/ExecutionEngine/Orc/Debugging/VTuneSupportPlugin.h"` in llvm/lib/ExecutionEngine/Orc/TargetProcess/JITLoaderVTune.cpp introduced a cyclic dependency.
This reverts commit 17efdad. It introduces a layering violation: #81826 (comment)
The revert above was on a fork, so 1a67dee applies the revert to the main repo. |
Ah, my bad -- I figured it was just an accident the revert was on a fork, didn't realize it was intentionally done so it could be done as a PR. |
This patch relands llvm#81826 This patch adds two plugins: VTuneSupportPlugin.cpp and JITLoaderVTune.cpp. The testing is done in a manner similar to llvm-jitlistener. Currently, we only support the old version of Intel VTune API.
[ORC] Re-land #81826 This patch adds two plugins: VTuneSupportPlugin.cpp and JITLoaderVTune.cpp. The testing is done in a manner similar to llvm-jitlistener. Currently, we only support the old version of Intel VTune API.
This patch adds two plugins: VTuneSupportPlugin.cpp and JITLoaderVTune.cpp. The testing is done in a manner similar to llvm-jitlistener. Currently, we only support the old version of Intel VTune API.
This pull request is stacked on top of #81825