Skip to content

Commit

Permalink
Put x64 specific benchmark code into ifdefs. (microsoft#20456)
Browse files Browse the repository at this point in the history
  • Loading branch information
edgchen1 authored Apr 25, 2024
1 parent 227c441 commit 2c19db0
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions onnxruntime/test/mlas/bench/bench_computesoftmax.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ void COMPUTESOFTMAXINPLACE(benchmark::State& state) {
free(ptr.underlying_buffer);
}

#if defined(MLAS_TARGET_AMD64)

void REDUCEMAXIMUMF32KERNELAVX(benchmark::State& state) {
const auto byte_aligned = narrow<int>(state.range(0));
const auto D = narrow<int>(state.range(1));
Expand Down Expand Up @@ -174,6 +176,8 @@ void COMPUTESOFTMAXOUTPUTF32KERNELAVX(benchmark::State& state) {
free(ptr.underlying_buffer);
}

#endif // defined(MLAS_TARGET_AMD64)

static void ComputeSoftmaxInplaceArgs(benchmark::internal::Benchmark* b) {
b->ArgNames({"ByteAligned", "N", "D", "Threads"});
for (int threads : {1, 8}) {
Expand All @@ -200,6 +204,8 @@ static void ComputeSoftmaxInplaceArgs(benchmark::internal::Benchmark* b) {

BENCHMARK(COMPUTESOFTMAXINPLACE)->Apply(ComputeSoftmaxInplaceArgs)->UseRealTime();

#if defined(MLAS_TARGET_AMD64)

BENCHMARK(REDUCEMAXIMUMF32KERNELAVX)
->ArgNames({"ByteAligned", "D"})
->ArgsProduct({
Expand Down Expand Up @@ -231,3 +237,5 @@ BENCHMARK(COMPUTESOFTMAXOUTPUTF32KERNELAVX)
{3, 4, 5, 7, 9, 11, 13, 15, 16, 500, 2000}, // D
})
->UseRealTime();

#endif // defined(MLAS_TARGET_AMD64)

0 comments on commit 2c19db0

Please sign in to comment.