Skip to content

Commit

Permalink
volatile size_t volatile_x = 0;
Browse files Browse the repository at this point in the history
for (size_t x = 0; x < body; x++) {
    volatile_x = x;
    // Your code here, using volatile_x if necessary
}
  • Loading branch information
jchen351 committed Jul 19, 2024
1 parent 33d08f3 commit 2452708
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions onnxruntime/test/onnx/microbenchmark/tptest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,10 @@ static void BM_ThreadPoolSimpleParallelFor(benchmark::State& state) {
for (auto _ : state) {
for (int j = 0; j < 100; j++) {
ThreadPool::TrySimpleParallelFor(tp.get(), len, [&](size_t) {
volatile size_t x = 0;
for (size_t i = 0; i < body; i++) {
x++;
volatile size_t volatile_x = 0;
for (size_t x = 0; x < body; x++) {
volatile_x = x;
// Your code here, using volatile_x if necessary
}
});
}
Expand Down

0 comments on commit 2452708

Please sign in to comment.