From aead882e6dc330e73113e12bb02540ff0dd2ad10 Mon Sep 17 00:00:00 2001
From: foreman
Date: Tue, 21 Jan 2020 16:52:40 -0500
Subject: [PATCH] P4 to Git Change 2061101 by
skudchad@skudchad_test2_win_opencl on 2020/01/21 16:47:25
SWDEV-219917 - [VDI Cleanup] Remove some direct OpenCL references, introduce a common functionality.
ReviewBoardURL = http://ocltc.amd.com/reviews/r/18488/diff/
Affected files ...
... //depot/stg/opencl/drivers/opencl/api/hip/build/Makefile.hip#30 edit
... //depot/stg/opencl/drivers/opencl/api/hip/fixme.cpp#3 edit
... //depot/stg/opencl/drivers/opencl/api/hip/hip_internal.hpp#51 edit
... //depot/stg/opencl/drivers/opencl/api/hip/hiprtc_internal.hpp#3 edit
... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/build/Makefile.api#190 edit
... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_common.hpp#25 edit
... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_context.cpp#61 edit
... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_device.cpp#75 edit
... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_execute.cpp#31 edit
... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_icd.cpp#36 edit
... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_platform_amd.cpp#3 edit
... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_program.cpp#54 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpudevice.cpp#610 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/paldevice.cpp#180 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocdevice.cpp#150 edit
... //depot/stg/opencl/drivers/opencl/runtime/include/vdi_agent_amd.h#1 add
... //depot/stg/opencl/drivers/opencl/runtime/include/vdi_common.hpp#1 add
... //depot/stg/opencl/drivers/opencl/runtime/os/os.hpp#32 edit
... //depot/stg/opencl/drivers/opencl/runtime/os/os_posix.cpp#49 edit
... //depot/stg/opencl/drivers/opencl/runtime/os/os_win32.cpp#50 edit
... //depot/stg/opencl/drivers/opencl/runtime/platform/agent.cpp#9 edit
... //depot/stg/opencl/drivers/opencl/runtime/platform/agent.hpp#7 edit
... //depot/stg/opencl/drivers/opencl/runtime/platform/context.cpp#54 edit
... //depot/stg/opencl/drivers/opencl/runtime/runtimedefs#54 edit
[ROCm/clr commit: 4c552a6423d63883c4549bfcb21bc6f6b5c00afa]
---
.../opencl/api/opencl/amdocl/cl_common.hpp | 136 +-----------------
.../opencl/api/opencl/amdocl/cl_context.cpp | 2 +-
.../opencl/api/opencl/amdocl/cl_device.cpp | 2 +-
.../opencl/api/opencl/amdocl/cl_execute.cpp | 1 +
.../clr/opencl/api/opencl/amdocl/cl_icd.cpp | 1 +
.../api/opencl/amdocl/cl_platform_amd.cpp | 1 +
.../opencl/api/opencl/amdocl/cl_program.cpp | 2 +-
7 files changed, 8 insertions(+), 137 deletions(-)
diff --git a/projects/clr/opencl/api/opencl/amdocl/cl_common.hpp b/projects/clr/opencl/api/opencl/amdocl/cl_common.hpp
index c642f82bd8..1eb381236d 100644
--- a/projects/clr/opencl/api/opencl/amdocl/cl_common.hpp
+++ b/projects/clr/opencl/api/opencl/amdocl/cl_common.hpp
@@ -6,102 +6,7 @@
#define CL_COMMON_HPP_
#include "top.hpp"
-#include "platform/runtime.hpp"
-#include "platform/command.hpp"
-#include "platform/memory.hpp"
-#include "thread/thread.hpp"
-#include "platform/commandqueue.hpp"
-
-#include
-#include
-
-//! \cond ignore
-namespace amd {
-
-template
-class NotNullWrapper
-{
-private:
- T* const ptrOrNull_;
-
-protected:
- explicit NotNullWrapper(T* ptrOrNull)
- : ptrOrNull_(ptrOrNull)
- { }
-
-public:
- void operator = (T value) const
- {
- if (ptrOrNull_ != NULL) {
- *ptrOrNull_ = value;
- }
- }
-};
-
-template
-class NotNullReference : protected NotNullWrapper
-{
-public:
- explicit NotNullReference(T* ptrOrNull)
- : NotNullWrapper(ptrOrNull)
- { }
-
- const NotNullWrapper& operator * () const { return *this; }
-};
-
-} // namespace amd
-
-template
-inline amd::NotNullReference
-not_null(T* ptrOrNull)
-{
- return amd::NotNullReference(ptrOrNull);
-}
-
-#define CL_CHECK_THREAD(thread) \
- (thread != NULL || ((thread = new amd::HostThread()) != NULL \
- && thread == amd::Thread::current()))
-
-#define RUNTIME_ENTRY_RET(ret, func, args) \
-CL_API_ENTRY ret CL_API_CALL \
-func args \
-{ \
- amd::Thread* thread = amd::Thread::current(); \
- if (!CL_CHECK_THREAD(thread)) { \
- *not_null(errcode_ret) = CL_OUT_OF_HOST_MEMORY; \
- return (ret) 0; \
- }
-
-#define RUNTIME_ENTRY_RET_NOERRCODE(ret, func, args) \
-CL_API_ENTRY ret CL_API_CALL \
-func args \
-{ \
- amd::Thread* thread = amd::Thread::current(); \
- if (!CL_CHECK_THREAD(thread)) { \
- return (ret) 0; \
- }
-
-#define RUNTIME_ENTRY(ret, func, args) \
-CL_API_ENTRY ret CL_API_CALL \
-func args \
-{ \
- amd::Thread* thread = amd::Thread::current(); \
- if (!CL_CHECK_THREAD(thread)) { \
- return CL_OUT_OF_HOST_MEMORY; \
- }
-
-#define RUNTIME_ENTRY_VOID(ret, func, args) \
-CL_API_ENTRY ret CL_API_CALL \
-func args \
-{ \
- amd::Thread* thread = amd::Thread::current(); \
- if (!CL_CHECK_THREAD(thread)) { \
- return; \
- }
-
-#define RUNTIME_EXIT \
- /* FIXME_lmoriche: we should check to thread->lastError here! */ \
-}
+#include "vdi_common.hpp"
//! Helper function to check "properties" parameter in various functions
int checkContextProperties(
@@ -110,34 +15,6 @@ int checkContextProperties(
namespace amd {
-namespace detail {
-
-template
-struct ParamInfo
-{
- static inline std::pair get(const T& param) {
- return std::pair(¶m, sizeof(T));
- }
-};
-
-template <>
-struct ParamInfo
-{
- static inline std::pair get(const char* param) {
- return std::pair(param, strlen(param) + 1);
- }
-};
-
-template
-struct ParamInfo
-{
- static inline std::pair get(const char* param) {
- return std::pair(param, strlen(param) + 1);
- }
-};
-
-} // namespace detail
-
template
static inline cl_int
clGetInfo(
@@ -160,7 +37,7 @@ clGetInfo(
typename std::remove_pointer::type>::type, char>()) {
return CL_INVALID_VALUE;
}
- // For char* and char[] params, we will at least fill up to
+ // For char* and char[] params, we will at least fill up to
// param_value_size, then return an error.
valueSize = param_value_size;
static_cast(param_value)[--valueSize] = '\0';
@@ -217,15 +94,6 @@ cl_int clEnqueueReleaseExtObjectsAMD(cl_command_queue command_queue,
cl_uint num_events_in_wait_list, const cl_event* event_wait_list,
cl_event* event, cl_command_type cmd_type);
-// This may need moving somewhere tidier...
-
-struct PlatformIDS { const struct KHRicdVendorDispatchRec* dispatch_; };
-class PlatformID {
-public:
- static PlatformIDS Platform;
-};
-#define AMD_PLATFORM (reinterpret_cast(&amd::PlatformID::Platform))
-
} // namespace amd
extern "C" {
diff --git a/projects/clr/opencl/api/opencl/amdocl/cl_context.cpp b/projects/clr/opencl/api/opencl/amdocl/cl_context.cpp
index 069647d280..f5a060be66 100644
--- a/projects/clr/opencl/api/opencl/amdocl/cl_context.cpp
+++ b/projects/clr/opencl/api/opencl/amdocl/cl_context.cpp
@@ -3,7 +3,7 @@
//
#include "cl_common.hpp"
-
+#include "vdi_common.hpp"
#include "platform/context.hpp"
#include "device/device.hpp"
#include "platform/runtime.hpp"
diff --git a/projects/clr/opencl/api/opencl/amdocl/cl_device.cpp b/projects/clr/opencl/api/opencl/amdocl/cl_device.cpp
index b841a43486..8bc2301e62 100644
--- a/projects/clr/opencl/api/opencl/amdocl/cl_device.cpp
+++ b/projects/clr/opencl/api/opencl/amdocl/cl_device.cpp
@@ -3,7 +3,7 @@
//
#include "cl_common.hpp"
-
+#include "vdi_common.hpp"
#include "device/device.hpp"
#include "platform/runtime.hpp"
#include "utils/versions.hpp"
diff --git a/projects/clr/opencl/api/opencl/amdocl/cl_execute.cpp b/projects/clr/opencl/api/opencl/amdocl/cl_execute.cpp
index ee799e66e4..cf8c85201c 100644
--- a/projects/clr/opencl/api/opencl/amdocl/cl_execute.cpp
+++ b/projects/clr/opencl/api/opencl/amdocl/cl_execute.cpp
@@ -3,6 +3,7 @@
//
#include "cl_common.hpp"
+#include "vdi_common.hpp"
#include "platform/kernel.hpp"
#include "platform/ndrange.hpp"
diff --git a/projects/clr/opencl/api/opencl/amdocl/cl_icd.cpp b/projects/clr/opencl/api/opencl/amdocl/cl_icd.cpp
index 7e4e317a45..d1ab064d44 100644
--- a/projects/clr/opencl/api/opencl/amdocl/cl_icd.cpp
+++ b/projects/clr/opencl/api/opencl/amdocl/cl_icd.cpp
@@ -3,6 +3,7 @@
//
#include "cl_common.hpp"
+#include "vdi_common.hpp"
#ifdef _WIN32
#include
#include "cl_d3d9_amd.hpp"
diff --git a/projects/clr/opencl/api/opencl/amdocl/cl_platform_amd.cpp b/projects/clr/opencl/api/opencl/amdocl/cl_platform_amd.cpp
index 329d9f519e..ec0ea12a66 100644
--- a/projects/clr/opencl/api/opencl/amdocl/cl_platform_amd.cpp
+++ b/projects/clr/opencl/api/opencl/amdocl/cl_platform_amd.cpp
@@ -2,6 +2,7 @@
// Copyright (c) 2010 Advanced Micro Devices, Inc. All rights reserved.
//
#include "cl_common.hpp"
+#include "vdi_common.hpp"
#include "cl_platform_amd.h"
#include
diff --git a/projects/clr/opencl/api/opencl/amdocl/cl_program.cpp b/projects/clr/opencl/api/opencl/amdocl/cl_program.cpp
index 8c71b17a6f..b76917e9e0 100644
--- a/projects/clr/opencl/api/opencl/amdocl/cl_program.cpp
+++ b/projects/clr/opencl/api/opencl/amdocl/cl_program.cpp
@@ -3,7 +3,7 @@
//
#include "cl_common.hpp"
-
+#include "vdi_common.hpp"
#include "platform/context.hpp"
#include "platform/program.hpp"
#include "platform/kernel.hpp"