Fixed cldnn compilation with static runtime (#4070)

This commit is contained in:
Ilya Lavrenov authored and GitHub committed 2021-02-02 20:11:40 +03:00
1 parent 804010bb1b
commit 685bf830d5
23 files changed
+84 -85

No files matched your search

+1 -1
View File
@@ -101,7 +101,7 @@ DECLARE_GPU_PARAM_KEY(MEM_HANDLE, gpu_handle_param);
* @brief This key identifies video decoder surface handle
* in a shared memory blob parameter map
*/
#ifdef WIN32
#ifdef _WIN32
DECLARE_GPU_PARAM_KEY(DEV_OBJECT_HANDLE, gpu_handle_param);
#else
DECLARE_GPU_PARAM_KEY(DEV_OBJECT_HANDLE, uint32_t);
@@ -269,7 +269,7 @@ float StdDevRelError(score_error_t error) {
}
#if !defined(__arm__) && !defined(_M_ARM) && !defined(__aarch64__) && !defined(_M_ARM64)
#if defined(_WIN32) || defined(WIN32)
#ifdef _WIN32
#include <intrin.h>
#include <windows.h>
#else
@@ -281,7 +281,7 @@ float StdDevRelError(score_error_t error) {
inline void native_cpuid(unsigned int *eax, unsigned int *ebx,
unsigned int *ecx, unsigned int *edx) {
size_t level = *eax;
#if defined(_WIN32) || defined(WIN32)
#ifdef _WIN32
int regs[4] = {static_cast<int>(*eax), static_cast<int>(*ebx), static_cast<int>(*ecx), static_cast<int>(*edx)};
__cpuid(regs, level);
*eax = static_cast<uint32_t>(regs[0]);
@@ -445,11 +445,11 @@ RemoteContext::Ptr clDNNEngine::CreateContext(const ParamMap& params) {
auto context = std::make_shared<CLDNNRemoteCLContext>(shared_from_this(), params, _impl->m_config);
return std::dynamic_pointer_cast<RemoteContext>(context);
} else if (GPU_PARAM_VALUE(VA_SHARED) == contextTypeStr) {
#ifdef WIN32
#ifdef _WIN32
auto context = std::make_shared<CLDNNRemoteD3DContext>(shared_from_this(), params, _impl->m_config);
#else
#else
auto context = std::make_shared<CLDNNRemoteVAContext>(shared_from_this(), params, _impl->m_config);
#endif
#endif
return std::dynamic_pointer_cast<RemoteContext>(context);
} else {
THROW_IE_EXCEPTION << "Invalid remote context type" << contextTypeStr;
@@ -36,7 +36,7 @@ ParamMap CLDNNRemoteBlobImpl::getParams() const {
{ GPU_PARAM_KEY(OCL_CONTEXT), params.context },
{ GPU_PARAM_KEY(MEM_HANDLE), params.mem }
};
#ifdef WIN32
#ifdef _WIN32
case BT_DX_BUF_SHARED:
return{
{ GPU_PARAM_KEY(SHARED_MEM_TYPE), GPU_PARAM_VALUE(DX_BUFFER) },
@@ -94,7 +94,7 @@ void CLDNNRemoteBlobImpl::allocate_if_needed() {
case BlobType::BT_BUF_SHARED:
m_memObject = std::unique_ptr<cldnn::memory>(new cldnn::memory(cldnn::memory::share_buffer(*eng, m_layout, m_mem)));
break;
#ifdef WIN32
#ifdef _WIN32
case BlobType::BT_SURF_SHARED:
m_memObject = std::unique_ptr<cldnn::memory>(new cldnn::memory(cldnn::memory::share_surface(*eng, m_layout, m_mem, m_plane)));
break;
@@ -130,7 +130,7 @@ void CLDNNRemoteBlobImpl::allocate() noexcept {
case BlobType::BT_BUF_SHARED:
m_memObject = std::unique_ptr<cldnn::memory>(new cldnn::memory(cldnn::memory::share_buffer(*eng, m_layout, m_mem)));
break;
#ifdef WIN32
#ifdef _WIN32
case BlobType::BT_SURF_SHARED:
m_memObject = std::unique_ptr<cldnn::memory>(new cldnn::memory(cldnn::memory::share_surface(*eng, m_layout, m_mem, m_plane)));
break;
@@ -19,10 +19,10 @@
# define NOMINMAX
#endif
#ifdef WIN32
#include <gpu/gpu_context_api_dx.hpp>
#ifdef _WIN32
# include <gpu/gpu_context_api_dx.hpp>
#else
#include <gpu/gpu_context_api_va.hpp>
# include <gpu/gpu_context_api_va.hpp>
#endif
namespace CLDNNPlugin {
@@ -122,7 +122,7 @@ protected:
using CLDNNRemoteCLbuffer = typedCLDNNRemoteBlob<InferenceEngine::gpu::ClBufferBlob>;
using CLDNNRemoteCLImage2D = typedCLDNNRemoteBlob<InferenceEngine::gpu::ClImage2DBlob>;
#ifdef WIN32
#ifdef _WIN32
using CLDNNRemoteD3DBuffer = typedCLDNNRemoteBlob<InferenceEngine::gpu::D3DBufferBlob>;
using CLDNNRemoteD3DSurface = typedCLDNNRemoteBlob<InferenceEngine::gpu::D3DSurface2DBlob>;
#else
@@ -130,7 +130,7 @@ using CLDNNRemoteVASurface = typedCLDNNRemoteBlob<InferenceEngine::gpu::VASurfac
#endif
inline CLDNNRemoteBlobImpl* getBlobImpl(InferenceEngine::gpu::ClBlob* blobPtr) {
#ifdef WIN32
#ifdef _WIN32
{
auto ptr = blobPtr->as<CLDNNRemoteD3DSurface>();
if (ptr) return ptr->getImpl();
@@ -257,7 +257,7 @@ class typedCLDNNExecutionContext : public TpublicContextAPI,
}
};
#ifdef WIN32
#ifdef _WIN32
using surf_key = _Key<cldnn::shared_handle, uint32_t>;
#else
using surf_key = _Key<cldnn::shared_surface, uint32_t>;
@@ -270,7 +270,7 @@ class typedCLDNNExecutionContext : public TpublicContextAPI,
using InferenceEngine::gpu::details::param_map_obj_getter;
InferenceEngine::RemoteBlob::Ptr ret = nullptr;
uint32_t plane = param_map_obj_getter::_ObjFromParamSimple<uint32_t>(params, GPU_PARAM_KEY(VA_PLANE));
#ifdef WIN32
#ifdef _WIN32
cldnn::shared_handle mem = param_map_obj_getter::_ObjFromParamSimple<cldnn::shared_handle>(params, GPU_PARAM_KEY(DEV_OBJECT_HANDLE));
surf_key skey(mem, plane);
#else
@@ -291,7 +291,7 @@ class typedCLDNNExecutionContext : public TpublicContextAPI,
auto smart_this =
std::dynamic_pointer_cast<InferenceEngine::gpu::ClContext>
(std::enable_shared_from_this<typedCLDNNExecutionContext<TpublicContextAPI>>::shared_from_this());
#ifdef WIN32
#ifdef _WIN32
ret = std::make_shared<CLDNNRemoteD3DSurface>(smart_this,
tensorDesc, layout, mem, 0, plane,
CLDNNRemoteBlobImpl::BlobType::BT_SURF_SHARED);
@@ -335,7 +335,7 @@ class typedCLDNNExecutionContext : public TpublicContextAPI,
layout.format = ImageFormatFromLayout(tensorDesc.getLayout());
ret = std::make_shared<CLDNNRemoteCLImage2D>(smart_this, tensorDesc, layout, mem, 0, 0, blob_type);
break;
#ifdef WIN32
#ifdef _WIN32
case CLDNNRemoteBlobImpl::BlobType::BT_DX_BUF_SHARED:
ret = std::make_shared<CLDNNRemoteD3DBuffer>(smart_this, tensorDesc, layout, mem, 0, 0, blob_type);
break;
@@ -402,7 +402,7 @@ public:
} else if (GPU_PARAM_VALUE(OCL_IMAGE2D) == memTypeStr) {
blob_type = CLDNNRemoteBlobImpl::BlobType::BT_IMG_SHARED;
mem = param_map_obj_getter::_ObjFromParamSimple<cldnn::shared_handle>(params, GPU_PARAM_KEY(MEM_HANDLE));
#ifdef WIN32
#ifdef _WIN32
} else if (GPU_PARAM_VALUE(DX_BUFFER) == memTypeStr) {
blob_type = CLDNNRemoteBlobImpl::BlobType::BT_DX_BUF_SHARED;
mem = param_map_obj_getter::_ObjFromParamSimple<cldnn::shared_handle>(params, GPU_PARAM_KEY(DEV_OBJECT_HANDLE));
@@ -426,14 +426,14 @@ protected:
};
using CLDNNRemoteCLContext = typedCLDNNExecutionContext<InferenceEngine::gpu::ClContext>;
#ifdef WIN32
#ifdef _WIN32
using CLDNNRemoteD3DContext = typedCLDNNExecutionContext<InferenceEngine::gpu::D3DContext>;
#else
using CLDNNRemoteVAContext = typedCLDNNExecutionContext<InferenceEngine::gpu::VAContext>;
#endif
inline CLDNNExecutionContextImpl* getContextImpl(InferenceEngine::gpu::ClContext::Ptr ctxPtr) {
#ifdef WIN32
#ifdef _WIN32
{
auto ptr = ctxPtr->as<CLDNNRemoteD3DContext>();
if (ptr) return ptr->getImpl();
@@ -76,13 +76,12 @@
#include "nodes/mkldnn_quantize_node.h"
#if !defined(__arm__) && !defined(_M_ARM) && !defined(__aarch64__) && !defined(_M_ARM64)
#if defined(_WIN32) || defined(WIN32)
#include <intrin.h>
#include <windows.h>
#else
#include <cpuid.h>
#endif
# ifdef _WIN32
# include <intrin.h>
# include <windows.h>
# else
# include <cpuid.h>
# endif
#endif
using namespace MKLDNNPlugin;
@@ -366,7 +365,7 @@ Parameter Engine::GetConfig(const std::string& name, const std::map<std::string,
static bool hasAVX512() {
#if !defined(__arm__) && !defined(_M_ARM) && !defined(__aarch64__) && !defined(_M_ARM64)
unsigned int regs[4] = {7, 0, 0, 0};
#if defined(_WIN32) || defined(WIN32)
#ifdef _WIN32
__cpuid(reinterpret_cast<int*>(regs), regs[0]);
#else
__cpuid_count(regs[0], regs[1], regs[0], regs[1], regs[2], regs[3]);
@@ -395,7 +394,7 @@ Parameter Engine::GetMetric(const std::string& name, const std::map<std::string,
unsigned int regs[4];
for (auto addr : addr_list) {
regs[0] = addr;
#if defined(_WIN32) || defined(WIN32)
#ifdef _WIN32
__cpuid(reinterpret_cast<int*>(regs), regs[0]);
#else
__get_cpuid(regs[0], &regs[0], &regs[1], &regs[2], &regs[3]);
@@ -5,29 +5,29 @@
#pragma once
#if defined (HAVE_SSE) || defined (HAVE_AVX2)
#if defined (_WIN32)
#include <emmintrin.h>
#else
#include <x86intrin.h>
#endif
# if defined (_WIN32)
# include <emmintrin.h>
# else
# include <x86intrin.h>
# endif
#endif
#if defined (WIN32) || defined (_WIN32)
#if defined (__INTEL_COMPILER)
#define DLSDK_EXT_IVDEP() __pragma(ivdep)
#elif defined(_MSC_VER)
#define DLSDK_EXT_IVDEP() __pragma(loop(ivdep))
#else
#define DLSDK_EXT_IVDEP()
#endif
#ifdef _WIN32
# if defined (__INTEL_COMPILER)
# define DLSDK_EXT_IVDEP() __pragma(ivdep)
# elif defined(_MSC_VER)
# define DLSDK_EXT_IVDEP() __pragma(loop(ivdep))
# else
# define DLSDK_EXT_IVDEP()
# endif
#elif defined(__linux__)
#if defined(__INTEL_COMPILER)
#define DLSDK_EXT_IVDEP() _Pragma("ivdep")
#elif defined(__GNUC__)
#define DLSDK_EXT_IVDEP() _Pragma("GCC ivdep")
# if defined(__INTEL_COMPILER)
# define DLSDK_EXT_IVDEP() _Pragma("ivdep")
# elif defined(__GNUC__)
# define DLSDK_EXT_IVDEP() _Pragma("GCC ivdep")
# else
# define DLSDK_EXT_IVDEP()
# endif
#else
#define DLSDK_EXT_IVDEP()
# define DLSDK_EXT_IVDEP()
#endif
#else
#define DLSDK_EXT_IVDEP()
#endif
@@ -191,7 +191,7 @@ static std::vector<uint32_t> s_PSROIPoolingNumROIs = {
};
TEST_P(myriadLayersTestsPSROIPooling_smoke, PSROIPooling) {
#if defined(_WIN32) || defined(WIN32)
#ifdef _WIN32
SKIP() << "Disabled for Windows. Issue-13239";
#endif
tensor_test_params dims_layer_in = std::get<0>(GetParam());
@@ -26,7 +26,7 @@ using namespace Regression::Matchers;
}while(false)
#if defined(_WIN32) || defined(WIN32)
#ifdef _WIN32
# define DISABLE_ON_WINDOWS_IF(expr) DISABLE_IF((expr))
#else
# define DISABLE_ON_WINDOWS_IF(expr)
@@ -16,7 +16,7 @@
# include <mach/mach.h>
#endif
#if defined(WIN32) || defined(WIN64)
#ifdef _WIN32
// Copied from linux libc sys/stat.h:
# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
@@ -28,7 +28,7 @@ static constexpr char ENV_HDDL_R[] = "IE_VPU_ENABLE_PER_LAYER_TESTS_HDDL";
} \
}
#if defined(_WIN32) || defined(WIN32)
#ifdef _WIN32
#define DISABLE_ON_WINDOWS_IF(expr) DISABLE_IF((expr))
#else
#define DISABLE_ON_WINDOWS_IF(expr)
+2 -2
View File
@@ -65,7 +65,7 @@ struct shared_mem_params {
shared_handle context; ///< OpenCL context for external operations
shared_handle user_device; ///< DX/VA device for external operations
shared_handle mem; ///< memory object handle
#ifdef WIN32
#ifdef _WIN32
shared_handle surface; ///< VA/DXVA surface handle
#else
shared_surface surface;
@@ -90,7 +90,7 @@ struct memory {
static memory share_image(const engine& engine, const layout& layout, shared_handle img, uint32_t net_id = 0);
/// Create shared memory object on @p engine over specified @p plane of video decoder surface @p surf using specified @p layout
#ifdef WIN32
#ifdef _WIN32
static memory share_surface(const engine& engine, const layout& layout, shared_handle surf, uint32_t plane,
uint32_t net_id = 0);
static memory share_dx_buffer(const engine& engine, const layout& layout, shared_handle res, uint32_t net_id = 0);
+4 -4
View File
@@ -72,7 +72,7 @@ void gpu_buffer::fill(unsigned char pattern, event_impl::ptr ev) {
shared_mem_params gpu_buffer::get_internal_params() const {
return {shared_mem_type::shared_mem_buffer, static_cast<shared_handle>(_context->context().get()), nullptr,
static_cast<shared_handle>(_buffer.get()),
#ifdef WIN32
#ifdef _WIN32
nullptr,
#else
0,
@@ -185,7 +185,7 @@ void gpu_image2d::fill(unsigned char pattern, event_impl::ptr ev) {
shared_mem_params gpu_image2d::get_internal_params() const {
return {shared_mem_type::shared_mem_image, static_cast<shared_handle>(_context->context().get()), nullptr,
static_cast<shared_handle>(_buffer.get()),
#ifdef WIN32
#ifdef _WIN32
nullptr,
#else
0,
@@ -211,7 +211,7 @@ shared_mem_params gpu_media_buffer::get_internal_params() const {
static_cast<shared_handle>(_buffer.get()), surface, plane };
}
#ifdef WIN32
#ifdef _WIN32
gpu_dx_buffer::gpu_dx_buffer(const refcounted_obj_ptr<engine_impl>& engine,
const layout& new_layout,
const shared_mem_params* params,
@@ -309,7 +309,7 @@ shared_mem_params gpu_usm::get_internal_params() const {
static_cast<shared_handle>(_engine->get_context()->context().get()), // context handle
nullptr, // user_device handle
nullptr, // mem handle
#ifdef WIN32
#ifdef _WIN32
nullptr, // surface handle
#else
0, // surface handle
+2 -2
View File
@@ -139,7 +139,7 @@ struct gpu_media_buffer : public gpu_image2d {
shared_mem_params get_internal_params() const override;
private:
void* device;
#ifdef WIN32
#ifdef _WIN32
void* surface;
#else
uint32_t surface;
@@ -147,7 +147,7 @@ private:
uint32_t plane;
};
#ifdef WIN32
#ifdef _WIN32
struct gpu_dx_buffer : public gpu_buffer {
friend cldnn::memory_pool;
+4 -4
View File
@@ -139,7 +139,7 @@ std::vector<device_impl::ptr> ocl_builder::build_device_list_from_user_device(b
continue;
std::vector<cl::Device> devices;
#ifdef WIN32
#ifdef _WIN32
platform.getDevices(CL_D3D11_DEVICE_KHR,
user_device,
CL_PREFERRED_DEVICES_FOR_D3D11_KHR,
@@ -153,11 +153,11 @@ std::vector<device_impl::ptr> ocl_builder::build_device_list_from_user_device(b
for (auto& device : devices) {
if (!does_device_match_config(out_out_order, device)) continue;
cl_context_properties props[] = {
#ifdef WIN32
#ifdef _WIN32
CL_CONTEXT_D3D11_DEVICE_KHR,
#else
#else
CL_CONTEXT_VA_API_DISPLAY_INTEL,
#endif
#endif
(intptr_t)user_device,
CL_CONTEXT_INTEROP_USER_SYNC, CL_FALSE,
CL_CONTEXT_PLATFORM, (cl_context_properties)id,
+1 -1
View File
@@ -45,7 +45,7 @@
cl::PFN_clEnqueueAcquireMediaSurfacesINTEL cl::SharedSurfLock::pfn_acquire = NULL;
cl::PFN_clEnqueueReleaseMediaSurfacesINTEL cl::SharedSurfLock::pfn_release = NULL;
cl::PFN_clCreateFromMediaSurfaceINTEL cl::ImageVA::pfn_clCreateFromMediaSurfaceINTEL = NULL;
#ifdef WIN32
#ifdef _WIN32
cl::PFN_clCreateFromD3D11Buffer cl::BufferDX::pfn_clCreateFromD3D11Buffer = NULL;
#endif
@@ -84,7 +84,7 @@ struct simple_attached_memory : memory_impl {
void unlock() override {}
void fill(unsigned char, event_impl::ptr) override {}
shared_mem_params get_internal_params() const override { return { shared_mem_type::shared_mem_empty, nullptr, nullptr, nullptr,
#ifdef WIN32
#ifdef _WIN32
nullptr,
#else
0,
+3 -3
View File
@@ -32,7 +32,7 @@ memory memory::allocate(const engine& engine, const layout& layout, uint32_t net
memory memory::share_buffer(const engine& engine, const layout& layout, shared_handle buf, uint32_t net_id) {
shared_mem_params params = { shared_mem_type::shared_mem_buffer, nullptr, nullptr, buf,
#ifdef WIN32
#ifdef _WIN32
nullptr,
#else
0,
@@ -43,7 +43,7 @@ memory memory::share_buffer(const engine& engine, const layout& layout, shared_h
memory memory::share_image(const engine& engine, const layout& layout, shared_handle img, uint32_t net_id) {
shared_mem_params params = { shared_mem_type::shared_mem_image, nullptr, nullptr, img,
#ifdef WIN32
#ifdef _WIN32
nullptr,
#else
0,
@@ -52,7 +52,7 @@ memory memory::share_image(const engine& engine, const layout& layout, shared_ha
return memory(engine.get()->reinterpret_handle(layout, &params, net_id).detach());
}
#ifdef WIN32
#ifdef _WIN32
memory memory::share_surface(const engine& engine, const layout& layout, shared_handle surf, uint32_t plane,
uint32_t net_id) {
shared_mem_params params = { shared_mem_type::shared_mem_vasurface, nullptr, nullptr, nullptr, surf, plane };
+1 -1
View File
@@ -90,7 +90,7 @@ memory_impl::ptr memory_pool::get_memory(const layout& layout, const shared_mem_
params,
net_id), false };
return mem_impl;
#ifdef WIN32
#ifdef _WIN32
} else if (params->mem_type == shared_mem_type::shared_mem_dxbuffer) {
memory_impl::ptr mem_impl{ new gpu::gpu_dx_buffer(engine_impl::ptr(_engine), layout,
params,
@@ -35,8 +35,8 @@
#include <sstream>
#include <iomanip>
#ifdef WIN32
#pragma warning(disable: 4503)
#ifdef _WIN32
# pragma warning(disable: 4503)
#endif
using namespace cldnn;
@@ -3,8 +3,8 @@
//
/* on windows min and max already defined that makes using numeric_limits impossible */
#if defined(WIN32)
#define NOMINMAX
#ifdef _WIN32
# define NOMINMAX
#endif
#include <sys/stat.h>
@@ -38,7 +38,7 @@
static char* m_exename = nullptr;
#if defined(WIN32) || defined(__APPLE__) || defined(ANDROID)
#if defined(_WIN32) || defined(__APPLE__) || defined(ANDROID)
typedef std::chrono::time_point<std::chrono::steady_clock> time_point;
#else
typedef std::chrono::time_point<std::chrono::system_clock> time_point;
@@ -25,12 +25,12 @@ the inputs.
#include <sstream>
#include <string>
#include <vector>
#ifdef WIN32
#include <windows.h>
#ifdef _WIN32
# include <windows.h>
#else // WIN32
#include <dirent.h>
#include <sys/stat.h>
#include <sys/types.h>
# include <dirent.h>
# include <sys/stat.h>
# include <sys/types.h>
#endif // WIN32
/// Fuzzing target
@@ -45,7 +45,7 @@ std::string basename(std::string const& path) {
/// Get directory content
std::vector<std::string> list_dir(std::string const& path) {
std::vector<std::string> res;
#ifdef WIN32
#ifdef _WIN32
WIN32_FIND_DATA find_data;
HANDLE find_handle;
find_handle = FindFirstFile((path + "\\*").c_str(), &find_data);
@@ -73,7 +73,7 @@ std::vector<std::string> list_dir(std::string const& path) {
// Check if file by given path is a directory.
bool is_dir(std::string const& path) {
#ifdef WIN32
#ifdef _WIN32
return 0 != (FILE_ATTRIBUTE_DIRECTORY & GetFileAttributes(path.c_str()));
#else // WIN32
struct stat stat_res = {0};