From 69221e57358519f0d5516c27cd6ac13584a8beff Mon Sep 17 00:00:00 2001 From: Vivek Kale <11766050+vlkale@users.noreply.github.com> Date: Fri, 10 May 2024 17:18:17 -0700 Subject: [PATCH 1/2] kp_sampler_skip.cpp: put begin for callee check before fence This improves performance in the case there is no callee for the kokkosp_begin_parallel_for. This is actually done correctly in the kokkosp_begin_parallel_scan and begin_parallel_reduce. --- common/kokkos-sampler/kp_sampler_skip.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/common/kokkos-sampler/kp_sampler_skip.cpp b/common/kokkos-sampler/kp_sampler_skip.cpp index 8df516e9e..0822d0a53 100644 --- a/common/kokkos-sampler/kp_sampler_skip.cpp +++ b/common/kokkos-sampler/kp_sampler_skip.cpp @@ -200,10 +200,11 @@ void kokkosp_begin_parallel_for(const char* name, const uint32_t devID, std::cout << "KokkosP: sample " << *kID << " calling child-begin function...\n"; } - if (tool_globFence) { - invoke_ktools_fence(0); - } + if (NULL != beginForCallee) { + if (tool_globFence) { + invoke_ktools_fence(0); + } uint64_t nestedkID = 0; (*beginForCallee)(name, devID, &nestedkID); if (tool_verbosity > 0) { From 4f8b237fcff7b78257e74b85a42bd5d0c8ecd028 Mon Sep 17 00:00:00 2001 From: Vivek Kale <11766050+vlkale@users.noreply.github.com> Date: Mon, 20 May 2024 17:57:47 -0700 Subject: [PATCH 2/2] kp_sampler_skip.cpp: apply clang-format --- common/kokkos-sampler/kp_sampler_skip.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/kokkos-sampler/kp_sampler_skip.cpp b/common/kokkos-sampler/kp_sampler_skip.cpp index 0822d0a53..4d8b578fb 100644 --- a/common/kokkos-sampler/kp_sampler_skip.cpp +++ b/common/kokkos-sampler/kp_sampler_skip.cpp @@ -200,7 +200,7 @@ void kokkosp_begin_parallel_for(const char* name, const uint32_t devID, std::cout << "KokkosP: sample " << *kID << " calling child-begin function...\n"; } - + if (NULL != beginForCallee) { if (tool_globFence) { invoke_ktools_fence(0);