From 667e111a6dfde502a3641e6c639c8e2a53b0d2f9 Mon Sep 17 00:00:00 2001 From: PietroGhg Date: Wed, 15 Nov 2023 10:26:57 +0000 Subject: [PATCH 1/2] Runtime changes for OCK integration --- source/adapters/native_cpu/enqueue.cpp | 6 +++++- source/adapters/native_cpu/nativecpu_state.hpp | 7 +++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/source/adapters/native_cpu/enqueue.cpp b/source/adapters/native_cpu/enqueue.cpp index d9e73c5453..c1e066c080 100644 --- a/source/adapters/native_cpu/enqueue.cpp +++ b/source/adapters/native_cpu/enqueue.cpp @@ -7,7 +7,6 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// - #include #include @@ -76,6 +75,10 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueKernelLaunch( for (unsigned g2 = 0; g2 < numWG2; g2++) { for (unsigned g1 = 0; g1 < numWG1; g1++) { for (unsigned g0 = 0; g0 < numWG0; g0++) { +#ifdef NATIVECPU_USE_OCK + state.update(g0, g1, g2); + hKernel->_subhandler(hKernel->_args.data(), &state); +#else for (unsigned local2 = 0; local2 < ndr.LocalSize[2]; local2++) { for (unsigned local1 = 0; local1 < ndr.LocalSize[1]; local1++) { for (unsigned local0 = 0; local0 < ndr.LocalSize[0]; local0++) { @@ -84,6 +87,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueKernelLaunch( } } } +#endif } } } diff --git a/source/adapters/native_cpu/nativecpu_state.hpp b/source/adapters/native_cpu/nativecpu_state.hpp index e813e5479c..118734d465 100644 --- a/source/adapters/native_cpu/nativecpu_state.hpp +++ b/source/adapters/native_cpu/nativecpu_state.hpp @@ -53,6 +53,13 @@ struct state { MGlobal_id[2] = MWorkGroup_size[2] * MWorkGroup_id[2] + MLocal_id[2] + MGlobalOffset[2]; } + + void update(size_t group0, size_t group1, size_t group2) { + MWorkGroup_id[0] = group0; + MWorkGroup_id[1] = group1; + MWorkGroup_id[2] = group2; + } + }; } // namespace native_cpu From 71e7e38eb7dbdac5c282f9d600f9690310aa2d82 Mon Sep 17 00:00:00 2001 From: PietroGhg Date: Mon, 4 Dec 2023 15:47:52 +0000 Subject: [PATCH 2/2] Formatting --- source/adapters/native_cpu/nativecpu_state.hpp | 1 - 1 file changed, 1 deletion(-) diff --git a/source/adapters/native_cpu/nativecpu_state.hpp b/source/adapters/native_cpu/nativecpu_state.hpp index 118734d465..c5016fc5aa 100644 --- a/source/adapters/native_cpu/nativecpu_state.hpp +++ b/source/adapters/native_cpu/nativecpu_state.hpp @@ -59,7 +59,6 @@ struct state { MWorkGroup_id[1] = group1; MWorkGroup_id[2] = group2; } - }; } // namespace native_cpu