Skip to content

Commit

Permalink
rebase
Browse files Browse the repository at this point in the history
Created using spr 1.3.4
  • Loading branch information
boomanaiden154 committed Dec 31, 2024
2 parents 73ddcf7 + c123c5b commit 40ad734
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions gematria/datasets/exegesis_benchmark_lib_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

#include "gematria/datasets/exegesis_benchmark_lib.h"

#include <sched.h>

#include <memory>
#include <optional>
#include <string>
Expand Down Expand Up @@ -446,5 +448,43 @@ TEST_F(ExegesisBenchmarkTest, TestBenchmarkFromAnnotatedBlock) {
EXPECT_LT(*BenchmarkResult, 10);
}

TEST_F(ExegesisBenchmarkTest, TestBenchmarkCorePinning) {
// clang-format off
const ExecutionAnnotations Annotations = ParseTextProto(R"pb(
code_start_address: 0
block_size: 4096
block_contents: 34359738376
accessed_blocks: 86016
initial_registers: [
{
register_name: "RCX"
register_value: 86016
},
{
register_name: "RSI"
register_value: 86016
}
]
loop_register: "RAX"
)pb");
// clang-format on

Expected<BenchmarkCode> BenchmarkConfiguration =
Benchmark->processAnnotatedBlock("3b31", Annotations);
ASSERT_TRUE(static_cast<bool>(BenchmarkConfiguration));

cpu_set_t process_cpu_mask;
ASSERT_FALSE(
sched_getaffinity(0, sizeof(process_cpu_mask), &process_cpu_mask));
if (!CPU_ISSET(0, &process_cpu_mask)) {
GTEST_SKIP()
<< "The CPU (0) used for testing core pinning is not available.";
}

Expected<double> BenchmarkResult =
Benchmark->benchmarkBasicBlock(*BenchmarkConfiguration, 0);
EXPECT_LT(*BenchmarkResult, 10);
}

} // namespace
} // namespace gematria

0 comments on commit 40ad734

Please sign in to comment.