From c19e054225273cec8d0f039fb14f10ccc09feec6 Mon Sep 17 00:00:00 2001 From: Benjamin Welton Date: Fri, 8 Dec 2023 01:25:23 -0800 Subject: [PATCH] Fix clock check for reproducible runtime (#281) * Fix clock check for reproducible runtime * source formatting (clang-format v11) (#282) Co-authored-by: bwelton --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: bwelton [ROCm/rocprofiler-sdk commit: efbb154515255868166cbea5fb180822ea6db240] --- .../apps/reproducible-runtime/reproducible-runtime.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/projects/rocprofiler-sdk/tests/apps/reproducible-runtime/reproducible-runtime.cpp b/projects/rocprofiler-sdk/tests/apps/reproducible-runtime/reproducible-runtime.cpp index b2d6bdea18..4c7ff2d2ab 100644 --- a/projects/rocprofiler-sdk/tests/apps/reproducible-runtime/reproducible-runtime.cpp +++ b/projects/rocprofiler-sdk/tests/apps/reproducible-runtime/reproducible-runtime.cpp @@ -134,14 +134,8 @@ main(int argc, char** argv) __global__ void reproducible_runtime(int64_t nspin_v) { - int64_t start = clock64(); - int64_t diff = 0; - - do - { - __syncthreads(); - diff = (clock64() - start); - } while(diff < nspin_v); + for(int i = 0; i < nspin_v / 64; i++) + asm volatile("s_sleep 1"); // ~64 cycles } void