[llvm] 30d7001 - Revert "[llvm-exegesis] Add in snippet address annotation (#74218)"
Aiden Grossman via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 6 11:25:29 PST 2023
Author: Aiden Grossman
Date: 2023-12-06T11:25:03-08:00
New Revision: 30d700117b772d94d8474ec56bd6f9cc423fc613
URL: https://github.com/llvm/llvm-project/commit/30d700117b772d94d8474ec56bd6f9cc423fc613
DIFF: https://github.com/llvm/llvm-project/commit/30d700117b772d94d8474ec56bd6f9cc423fc613.diff
LOG: Revert "[llvm-exegesis] Add in snippet address annotation (#74218)"
This reverts commit 3ab41f912a6c219a93b87c257139822ea07c8863.
Unit tests break after recent changes. Will investigate/reland.
Added:
Modified:
llvm/test/tools/llvm-exegesis/X86/latency/memory-annotations-unsupported.s
llvm/tools/llvm-exegesis/lib/BenchmarkResult.h
llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp
llvm/tools/llvm-exegesis/lib/SnippetFile.cpp
llvm/tools/llvm-exegesis/llvm-exegesis.cpp
llvm/unittests/tools/llvm-exegesis/X86/SnippetFileTest.cpp
Removed:
llvm/test/tools/llvm-exegesis/X86/latency/snippet-address-annotations-unsupported.s
llvm/test/tools/llvm-exegesis/X86/latency/subprocess-address-annotation.s
################################################################################
diff --git a/llvm/test/tools/llvm-exegesis/X86/latency/memory-annotations-unsupported.s b/llvm/test/tools/llvm-exegesis/X86/latency/memory-annotations-unsupported.s
index c483d28adf0e1..5d06a0ceff5c7 100644
--- a/llvm/test/tools/llvm-exegesis/X86/latency/memory-annotations-unsupported.s
+++ b/llvm/test/tools/llvm-exegesis/X86/latency/memory-annotations-unsupported.s
@@ -2,7 +2,7 @@
# RUN: not llvm-exegesis -mtriple=x86_64-unknown-unknown -snippets-file=%s -mode=latency 2>&1 | FileCheck %s
-# CHECK: llvm-exegesis error: Memory and snippet address annotations are only supported in subprocess execution mode
+# CHECK: llvm-exegesis error: Memory annotations are only supported in subprocess execution mode
# LLVM-EXEGESIS-MEM-DEF test1 4096 ff
diff --git a/llvm/test/tools/llvm-exegesis/X86/latency/snippet-address-annotations-unsupported.s b/llvm/test/tools/llvm-exegesis/X86/latency/snippet-address-annotations-unsupported.s
deleted file mode 100644
index c38c41d2aed9b..0000000000000
--- a/llvm/test/tools/llvm-exegesis/X86/latency/snippet-address-annotations-unsupported.s
+++ /dev/null
@@ -1,9 +0,0 @@
-# REQUIRES: exegesis-can-measure-latency, x86_64-linux
-
-# RUN: not llvm-exegesis -mtriple=x86_64-unknown-unknown -snippets-file=%s -mode=latency 2>&1 | FileCheck %s
-
-# CHECK: llvm-exegesis error: Memory and snippet address annotations are only supported in subprocess execution mode
-
-# LLVM-EXEGESIS-SNIPPET-ADDRESS 10000
-
-movq $0, %rax
diff --git a/llvm/test/tools/llvm-exegesis/X86/latency/subprocess-address-annotation.s b/llvm/test/tools/llvm-exegesis/X86/latency/subprocess-address-annotation.s
deleted file mode 100644
index 1b104b30bb288..0000000000000
--- a/llvm/test/tools/llvm-exegesis/X86/latency/subprocess-address-annotation.s
+++ /dev/null
@@ -1,26 +0,0 @@
-# REQUIRES: exegesis-can-measure-latency, x86_64-linux
-
-# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mode=latency -snippets-file=%s -execution-mode=subprocess | FileCheck %s
-
-# Check that the code is loaded in at the expected address.
-
-# LLVM-EXEGESIS-SNIPPET-ADDRESS 20000
-# LLVM-EXEGESIS-DEFREG RAX 0
-# LLVM-EXEGESIS-DEFREG R14 127
-# LLVM-EXEGESIS-DEFREG R15 0
-# LLVM-EXEGESIS-DEFREG RDI 0
-
-# Load the instruction pointer and round down to the nearest page as there
-# will be some setup code loaded in before this part begins to execute.
-lea 0(%rip), %rax
-shrq $12, %rax
-shlq $12, %rax
-
-cmpq $0x20000, %rax
-cmovneq %r14, %r15
-
-movq $60, %rax
-movq %r15, %rdi
-syscall
-
-# CHECK-NOT: error: 'Child benchmarking process exited with non-zero exit code: Child process returned with unknown exit code'
diff --git a/llvm/tools/llvm-exegesis/lib/BenchmarkResult.h b/llvm/tools/llvm-exegesis/lib/BenchmarkResult.h
index 0d08febae20cb..38111519a2c89 100644
--- a/llvm/tools/llvm-exegesis/lib/BenchmarkResult.h
+++ b/llvm/tools/llvm-exegesis/lib/BenchmarkResult.h
@@ -70,9 +70,6 @@ struct BenchmarkKey {
// An opaque configuration, that can be used to separate several benchmarks of
// the same instruction under
diff erent configurations.
std::string Config;
- // The address that the snippet should be loaded in at if the execution mode
- // being used supports it.
- intptr_t SnippetAddress = 0;
};
struct BenchmarkMeasure {
diff --git a/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp b/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp
index d1b0a58281cd4..dd7c1a3155317 100644
--- a/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp
+++ b/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp
@@ -416,17 +416,9 @@ class SubProcessFunctionExecutorImpl
#endif // GLIBC_INITS_RSEQ
size_t FunctionDataCopySize = this->Function.FunctionBytes.size();
- void *MapAddress = NULL;
- int MapFlags = MAP_PRIVATE | MAP_ANONYMOUS;
-
- if (Key.SnippetAddress != 0) {
- MapAddress = reinterpret_cast<void *>(Key.SnippetAddress);
- MapFlags |= MAP_FIXED_NOREPLACE;
- }
-
char *FunctionDataCopy =
- (char *)mmap(MapAddress, FunctionDataCopySize, PROT_READ | PROT_WRITE,
- MapFlags, 0, 0);
+ (char *)mmap(NULL, FunctionDataCopySize, PROT_READ | PROT_WRITE,
+ MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
if ((intptr_t)FunctionDataCopy == -1)
exit(ChildProcessExitCodeE::FunctionDataMappingFailed);
diff --git a/llvm/tools/llvm-exegesis/lib/SnippetFile.cpp b/llvm/tools/llvm-exegesis/lib/SnippetFile.cpp
index 286c606cd6fb1..d85a9f190655a 100644
--- a/llvm/tools/llvm-exegesis/lib/SnippetFile.cpp
+++ b/llvm/tools/llvm-exegesis/lib/SnippetFile.cpp
@@ -131,19 +131,6 @@ class BenchmarkCodeStreamer : public MCStreamer, public AsmCommentConsumer {
Result->Key.MemoryMappings.push_back(std::move(MemMap));
return;
}
- if (CommentText.consume_front("SNIPPET-ADDRESS")) {
- // LLVM-EXEGESIS-SNIPPET-ADDRESS <address>
- if (!to_integer<intptr_t>(CommentText.trim(), Result->Key.SnippetAddress,
- 16)) {
- errs() << "invalid comment 'LLVM-EXEGESIS-SNIPPET-ADDRESS "
- << CommentText
- << "', expected <ADDRESS> to contain a valid integer in "
- "hexadecimal format";
- ++InvalidComments;
- return;
- }
- return;
- }
}
unsigned numInvalidComments() const { return InvalidComments; }
diff --git a/llvm/tools/llvm-exegesis/llvm-exegesis.cpp b/llvm/tools/llvm-exegesis/llvm-exegesis.cpp
index 66bc94271756c..261335a817d06 100644
--- a/llvm/tools/llvm-exegesis/llvm-exegesis.cpp
+++ b/llvm/tools/llvm-exegesis/llvm-exegesis.cpp
@@ -533,10 +533,8 @@ void benchmarkMain() {
for (const auto &Configuration : Configurations) {
if (ExecutionMode != BenchmarkRunner::ExecutionModeE::SubProcess &&
(Configuration.Key.MemoryMappings.size() != 0 ||
- Configuration.Key.MemoryValues.size() != 0 ||
- Configuration.Key.SnippetAddress != 0))
- ExitWithError("Memory and snippet address annotations are only "
- "supported in subprocess "
+ Configuration.Key.MemoryValues.size() != 0))
+ ExitWithError("Memory annotations are only supported in subprocess "
"execution mode");
}
}
diff --git a/llvm/unittests/tools/llvm-exegesis/X86/SnippetFileTest.cpp b/llvm/unittests/tools/llvm-exegesis/X86/SnippetFileTest.cpp
index 52eb211c37272..2bab3aa15baad 100644
--- a/llvm/unittests/tools/llvm-exegesis/X86/SnippetFileTest.cpp
+++ b/llvm/unittests/tools/llvm-exegesis/X86/SnippetFileTest.cpp
@@ -209,16 +209,6 @@ TEST_F(X86SnippetFileTest, MemoryMappingNoDefinition) {
consumeError(std::move(Error));
}
-TEST_F(X86SnippetFileTest, SnippetAddress) {
- auto Snippets = TestCommon(R"(
- # LLVM-EXEGESIS-SNIPPET-ADDRESS 0x10000
- )");
- ASSERT_TRUE(static_cast<bool>(Snippets));
- EXPECT_THAT(*Snippets, SizeIs(1));
- const auto &Snippet = (*Snippets)[0];
- EXPECT_EQ(Snippet.Key.SnippetAddress, 0x10000);
-}
-
} // namespace
} // namespace exegesis
} // namespace llvm
More information about the llvm-commits
mailing list