[PATCH] D97504: [llvm-exegesis] Disable the LBR check on AMD
Vy Nguyen via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 25 14:45:52 PST 2021
oontvoo updated this revision to Diff 326519.
oontvoo added a comment.
cleanup
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D97504/new/
https://reviews.llvm.org/D97504
Files:
llvm/tools/llvm-exegesis/lib/Target.h
llvm/tools/llvm-exegesis/lib/X86/Target.cpp
llvm/tools/llvm-exegesis/llvm-exegesis.cpp
Index: llvm/tools/llvm-exegesis/llvm-exegesis.cpp
===================================================================
--- llvm/tools/llvm-exegesis/llvm-exegesis.cpp
+++ llvm/tools/llvm-exegesis/llvm-exegesis.cpp
@@ -299,7 +299,7 @@
// Preliminary check to ensure features needed for requested
// benchmark mode are present on target CPU and/or OS.
- ExitOnErr(State.getExegesisTarget().checkFeatureSupport());
+ ExitOnErr(State.getExegesisTarget().checkFeatureSupport(State));
const std::unique_ptr<BenchmarkRunner> Runner =
ExitOnErr(State.getExegesisTarget().createBenchmarkRunner(
Index: llvm/tools/llvm-exegesis/lib/X86/Target.cpp
===================================================================
--- llvm/tools/llvm-exegesis/lib/X86/Target.cpp
+++ llvm/tools/llvm-exegesis/lib/X86/Target.cpp
@@ -719,7 +719,7 @@
return Arch == Triple::x86_64 || Arch == Triple::x86;
}
- Error checkFeatureSupport() const override {
+ Error checkFeatureSupport(const LLVMState &state) const override {
// LBR is the only feature we conditionally support now.
// So if LBR is not requested, then we should be able to run the benchmarks.
if (LbrSamplingPeriod == 0)
@@ -727,13 +727,18 @@
#if defined(__linux__) && defined(HAVE_LIBPFM) && \
defined(LIBPFM_HAS_FIELD_CYCLES)
- // If the kernel supports it, the hardware still may not have it.
- return X86LbrCounter::checkLbrSupport();
-#else
+ // FIXME: Fix this.
+ // https://bugs.llvm.org/show_bug.cgi?id=48918
+ // For now, don't do the check if we see an AMD machine because
+ // the counter uses some intel-specific magic and it could
+ // be confuse and think the AMD machine actually has LBR support.
+ if (state.getSubtargetInfo().getCPU().compare_lower("amd") != 0)
+ // If the kernel supports it, the hardware still may not have it.
+ return X86LbrCounter::checkLbrSupport();
+#endif
return llvm::make_error<llvm::StringError>(
"LBR not supported on this kernel and/or platform",
llvm::errc::not_supported);
-#endif
}
std::unique_ptr<SavedState> withSavedState() const override {
Index: llvm/tools/llvm-exegesis/lib/Target.h
===================================================================
--- llvm/tools/llvm-exegesis/lib/Target.h
+++ llvm/tools/llvm-exegesis/lib/Target.h
@@ -145,7 +145,9 @@
// Checks hardware and software support for current benchmark mode.
// Returns an error if the target host does not have support to run the
// benchmark.
- virtual Error checkFeatureSupport() const { return Error::success(); }
+ virtual Error checkFeatureSupport(const LLVMState &) const {
+ return Error::success();
+ }
// Creates a snippet generator for the given mode.
std::unique_ptr<SnippetGenerator>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D97504.326519.patch
Type: text/x-patch
Size: 2823 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210225/bf2530bf/attachment.bin>
More information about the llvm-commits
mailing list