From 741fd33189dfc4c482eb32edb7a66e62aff2540c Mon Sep 17 00:00:00 2001
From: foreman
Date: Tue, 16 May 2017 17:22:59 -0400
Subject: [PATCH] P4 to Git Change 1410373 by gandryey@gera-w8 on 2017/05/16
17:16:52
SWDEV-120180 - [amdgpu-pro] OpenCL support for SSG
- Add initial support of DGMA memory under ROCr backend.
- The implementation requires amdgpu-pro stack initialization and memory allocation.
- An interop with HSA device is created for ROCr access
Affected files ...
... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/Makefile#10 edit
... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/build/Makefile.api#153 edit
... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_lqdflash_amd.cpp#18 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/device.hpp#285 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpusettings.cpp#351 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/build/Makefile.oclrocm#16 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/pro/lnxheaders.h#1 add
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/pro/prodevice.cpp#1 add
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/pro/prodevice.hpp#1 add
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/pro/prodriver.hpp#1 add
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocdevice.cpp#51 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocdevice.hpp#21 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocmemory.cpp#19 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocsettings.cpp#18 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocvirtual.cpp#38 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocvirtual.hpp#11 edit
... //depot/stg/opencl/drivers/opencl/runtime/platform/memory.hpp#101 edit
... //depot/stg/opencl/drivers/opencl/runtime/runtimedefs#41 edit
---
opencl/api/opencl/amdocl/cl_lqdflash_amd.cpp | 21 ++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
diff --git a/opencl/api/opencl/amdocl/cl_lqdflash_amd.cpp b/opencl/api/opencl/amdocl/cl_lqdflash_amd.cpp
index f7a23dc980..dc32cf9ac2 100644
--- a/opencl/api/opencl/amdocl/cl_lqdflash_amd.cpp
+++ b/opencl/api/opencl/amdocl/cl_lqdflash_amd.cpp
@@ -5,15 +5,13 @@
#include "cl_common.hpp"
#include
+#include
+#include
#include "platform/object.hpp"
#include "cl_lqdflash_amd.h"
-#if defined __linux__
-typedef wchar_t char_t;
-#endif // __linux__
-
-#if !defined(BUILD_HSA_TARGET) && defined(_WIN32)
+#if (!defined(BUILD_HSA_TARGET) && defined(WITH_HSA_DEVICE)) || defined(_WIN32)
#define WITH_LIQUID_FLASH 1
#endif // _WIN32
@@ -21,7 +19,6 @@ typedef wchar_t char_t;
#include "lf.h"
#endif // WITH_LIQUID_FLASH
-
namespace amd {
LiquidFlashFile::~LiquidFlashFile() { close(); }
@@ -29,7 +26,7 @@ LiquidFlashFile::~LiquidFlashFile() { close(); }
bool LiquidFlashFile::open() {
#if defined WITH_LIQUID_FLASH
lf_status err;
- lf_file_flags flags;
+ lf_file_flags flags = 0;
switch (flags_) {
case CL_FILE_READ_ONLY_AMD:
@@ -42,8 +39,16 @@ bool LiquidFlashFile::open() {
flags = LF_READ | LF_WRITE;
break;
}
+#ifdef ATI_OS_LINUX
+ assert(sizeof(wchar_t) != sizeof(lf_char));
+ std::string name_char;
+ std::wstring_convert, wchar_t> cv;
+ name_char = cv.to_bytes(name_);
+ handle_ = lfOpenFile(name_char.c_str(), flags, &err);
+#else
+ handle_ = lfOpenFile(name_.c_str(), flags, &err);
+#endif
- handle_ = lfOpenFile(name_, flags, &err);
if (err != lf_success) {
return false;
}