From 72a5c2c6c43190491445eb3c865d600cfef86318 Mon Sep 17 00:00:00 2001 From: Mateusz Hoppe Date: Fri, 1 Mar 2019 19:29:58 +0100 Subject: [PATCH] Fix compilation with OCL_RUNTIME_PROFILING Change-Id: Ib07543fb5f6048e99cdd198111ba88309da2c3e8 Signed-off-by: Mateusz Hoppe --- runtime/api/api.cpp | 3 +-- runtime/os_interface/linux/linux_inc.cpp | 23 ++------------------ runtime/os_interface/linux/os_inc.h | 6 +---- runtime/os_interface/windows/os_inc.h | 6 +---- runtime/os_interface/windows/windows_inc.cpp | 23 ++------------------ runtime/utilities/api_intercept.h | 4 ++-- runtime/utilities/perf_profiler.cpp | 4 +++- runtime/utilities/perf_profiler.h | 3 +++ 8 files changed, 15 insertions(+), 57 deletions(-) diff --git a/runtime/api/api.cpp b/runtime/api/api.cpp index 35b495b094..2d0b90af4d 100644 --- a/runtime/api/api.cpp +++ b/runtime/api/api.cpp @@ -3070,8 +3070,7 @@ clCreatePerfCountersCommandQueueINTEL( cl_command_queue_properties properties, cl_uint configuration, cl_int *errcodeRet) { - cl_int retVal = CL_SUCCESS; - API_ENTER(&retVal); + API_ENTER(nullptr); DBG_LOG_INPUTS("context", context, "device", device, diff --git a/runtime/os_interface/linux/linux_inc.cpp b/runtime/os_interface/linux/linux_inc.cpp index 90929575b0..cd42ff9ff4 100644 --- a/runtime/os_interface/linux/linux_inc.cpp +++ b/runtime/os_interface/linux/linux_inc.cpp @@ -1,30 +1,11 @@ /* - * Copyright (c) 2017, Intel Corporation + * Copyright (C) 2017-2019 Intel Corporation * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: + * SPDX-License-Identifier: MIT * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. */ #include "runtime/os_interface/linux/os_inc.h" -#include "runtime/utilities/perf_profiler.h" namespace Os { const char *fileSeparator = "/"; } -namespace OCLRT { -thread_local OCLRT::PerfProfiler *gPerfProfiler = nullptr; -} diff --git a/runtime/os_interface/linux/os_inc.h b/runtime/os_interface/linux/os_inc.h index 92a3b435e7..400a97851a 100644 --- a/runtime/os_interface/linux/os_inc.h +++ b/runtime/os_interface/linux/os_inc.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2018 Intel Corporation + * Copyright (C) 2017-2019 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -9,7 +9,3 @@ #define PATH_SEPARATOR '/' #define __cdecl -namespace OCLRT { -class PerfProfiler; -extern thread_local PerfProfiler *gPerfProfiler; -}; // namespace OCLRT diff --git a/runtime/os_interface/windows/os_inc.h b/runtime/os_interface/windows/os_inc.h index e943ae1b8c..b401aae615 100644 --- a/runtime/os_interface/windows/os_inc.h +++ b/runtime/os_interface/windows/os_inc.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2018 Intel Corporation + * Copyright (C) 2017-2019 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -8,10 +8,6 @@ #pragma once #define PATH_SEPARATOR '\\' -namespace OCLRT { -class PerfProfiler; -extern __declspec(thread) PerfProfiler *gPerfProfiler; -}; // namespace OCLRT // For now we need to keep this file clean of OS specific #includes. // Only issues to address portability should be covered here. diff --git a/runtime/os_interface/windows/windows_inc.cpp b/runtime/os_interface/windows/windows_inc.cpp index e8ce36b005..ce73537687 100644 --- a/runtime/os_interface/windows/windows_inc.cpp +++ b/runtime/os_interface/windows/windows_inc.cpp @@ -1,29 +1,10 @@ /* - * Copyright (c) 2017, Intel Corporation + * Copyright (C) 2017-2019 Intel Corporation * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: + * SPDX-License-Identifier: MIT * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. */ -#include "runtime/utilities/perf_profiler.h" namespace Os { const char *fileSeparator = "/"; } -namespace OCLRT { -__declspec(thread) PerfProfiler *gPerfProfiler = nullptr; -} diff --git a/runtime/utilities/api_intercept.h b/runtime/utilities/api_intercept.h index 6fa75ef058..1d15b42021 100644 --- a/runtime/utilities/api_intercept.h +++ b/runtime/utilities/api_intercept.h @@ -28,10 +28,10 @@ #define SYSTEM_ENTER() \ PerfProfiler::create(); \ - gPerfProfiler->SystemEnter(); + gPerfProfiler->systemEnter(); #define SYSTEM_LEAVE(id) \ - gPerfProfiler->SystemLeave(id); + gPerfProfiler->systemLeave(id); #define WAIT_ENTER() \ SYSTEM_ENTER() #define WAIT_LEAVE() \ diff --git a/runtime/utilities/perf_profiler.cpp b/runtime/utilities/perf_profiler.cpp index 3df69ee515..080b51fc1b 100644 --- a/runtime/utilities/perf_profiler.cpp +++ b/runtime/utilities/perf_profiler.cpp @@ -7,7 +7,7 @@ #include "runtime/utilities/perf_profiler.h" -#include +#include "runtime/utilities/stackvec.h" #include "os_inc.h" @@ -22,6 +22,8 @@ namespace OCLRT { std::atomic PerfProfiler::counter(0); +thread_local PerfProfiler *gPerfProfiler = nullptr; + PerfProfiler *PerfProfiler::objects[PerfProfiler::objectsNumber] = { nullptr, }; diff --git a/runtime/utilities/perf_profiler.h b/runtime/utilities/perf_profiler.h index cd277302b7..8e83a235b3 100644 --- a/runtime/utilities/perf_profiler.h +++ b/runtime/utilities/perf_profiler.h @@ -99,6 +99,9 @@ class PerfProfiler { }; #if OCL_RUNTIME_PROFILING == 1 + +extern thread_local PerfProfiler *gPerfProfiler; + struct PerfProfilerApiWrapper { PerfProfilerApiWrapper(const char *funcName) : funcName(funcName) {