From a7608574183069c25ea93991d87c955dbc53e6cb Mon Sep 17 00:00:00 2001
From: foreman
Date: Mon, 24 Oct 2016 01:24:38 -0400
Subject: [PATCH] P4 to Git Change 1330411 by lmoriche@lmoriche_opencl_lc on
2016/10/24 01:16:07
SWDEV-105604 - [OCL-LC-PAL] OpenCL program manager for LC on PAL
- Add Windows support
Affected files ...
... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/amdocl.def.in#16 edit
... //depot/stg/opencl/drivers/opencl/compiler/lib/loaders/elf/utils/common/win32/compat.h#4 edit
... //depot/stg/opencl/drivers/opencl/compiler/lib/utils/options.cpp#38 edit
... //depot/stg/opencl/drivers/opencl/make/clang.git/include/build/Makefile.include#4 edit
... //depot/stg/opencl/drivers/opencl/make/llvm.git/win32/include/llvm/Config/config.h#2 edit
... //depot/stg/opencl/drivers/opencl/opencldefs#190 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palcompiler.cpp#5 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palkernel.cpp#12 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palprogram.cpp#12 edit
... //depot/stg/opencl/drivers/opencl/runtime/top.hpp#24 edit
---
rocclr/compiler/lib/utils/options.cpp | 1 +
rocclr/runtime/device/pal/palcompiler.cpp | 6 +++
rocclr/runtime/device/pal/palkernel.cpp | 2 -
rocclr/runtime/device/pal/palprogram.cpp | 6 +++
rocclr/runtime/top.hpp | 45 ++++++++++++++++++++++-
5 files changed, 56 insertions(+), 4 deletions(-)
diff --git a/rocclr/compiler/lib/utils/options.cpp b/rocclr/compiler/lib/utils/options.cpp
index 9d05ed4c2f..d587faf017 100644
--- a/rocclr/compiler/lib/utils/options.cpp
+++ b/rocclr/compiler/lib/utils/options.cpp
@@ -7,6 +7,7 @@
#include
#include
#include
+#include
#include
#include "options.hpp"
diff --git a/rocclr/runtime/device/pal/palcompiler.cpp b/rocclr/runtime/device/pal/palcompiler.cpp
index 3ef2f9b999..c3b8f21cd7 100644
--- a/rocclr/runtime/device/pal/palcompiler.cpp
+++ b/rocclr/runtime/device/pal/palcompiler.cpp
@@ -6,6 +6,7 @@
#include
#include
#include
+#include
#include "os/os.hpp"
#include "device/pal/paldevice.hpp"
@@ -242,9 +243,14 @@ LightningProgram::compileImpl(
driverOptions.append(optLevel.str());
// Set the machine target
+#if 0
std::ostringstream mCPU;
mCPU << " -mcpu=gfx" << dev().hwInfo()->gfxipVersion_;
driverOptions.append(mCPU.str());
+#else
+ driverOptions.append(" -mcpu=");
+ driverOptions.append(dev().hwInfo()->machineTarget_);
+#endif
driverOptions.append(options->llvmOptions);
driverOptions.append(hsailOptions());
diff --git a/rocclr/runtime/device/pal/palkernel.cpp b/rocclr/runtime/device/pal/palkernel.cpp
index 43e0cf277c..b639715f00 100644
--- a/rocclr/runtime/device/pal/palkernel.cpp
+++ b/rocclr/runtime/device/pal/palkernel.cpp
@@ -1440,8 +1440,6 @@ GetKernelAddrQual(const amd::hsa::code::KernelArg::Metadata& lcArg)
static inline HSAIL_DATA_TYPE
GetKernelDataType(const amd::hsa::code::KernelArg::Metadata& lcArg)
{
- aclArgDataType dataType;
-
if (lcArg.Kind() != AMDGPU::RuntimeMD::KernelArg::ByValue) {
return HSAIL_DATATYPE_ERROR;
}
diff --git a/rocclr/runtime/device/pal/palprogram.cpp b/rocclr/runtime/device/pal/palprogram.cpp
index f549db1516..8fe8796525 100644
--- a/rocclr/runtime/device/pal/palprogram.cpp
+++ b/rocclr/runtime/device/pal/palprogram.cpp
@@ -14,6 +14,7 @@
#include
#include
#include
+#include
#include "utils/options.hpp"
#include "hsa.h"
#include "hsa_ext_image.h"
@@ -1205,9 +1206,14 @@ LightningProgram::linkImpl(amd::option::Options *options)
std::string codegenOptions(options->llvmOptions);
// Set the machine target
+#if 0
std::ostringstream mCPU;
mCPU << " -mcpu=gfx" << dev().hwInfo()->gfxipVersion_;
codegenOptions.append(mCPU.str());
+#else
+ codegenOptions.append(" -mcpu=");
+ codegenOptions.append(dev().hwInfo()->machineTarget_);
+#endif
// Set the -O#
std::ostringstream optLevel;
diff --git a/rocclr/runtime/top.hpp b/rocclr/runtime/top.hpp
index e2131f4403..5d1d9ba835 100644
--- a/rocclr/runtime/top.hpp
+++ b/rocclr/runtime/top.hpp
@@ -10,7 +10,46 @@
#endif /*ATI_ARCH_ARM*/
#ifdef _WIN32
-# define NOMINMAX 1
+// Disable unneeded features of for efficiency.
+# define NOGDICAPMASKS
+# define NOVIRTUALKEYCODES
+# define NOWINMESSAGES
+# define NOWINSTYLES
+# define NOSYSMETRICS
+# define NOMENUS
+# define NOICONS
+# define NOKEYSTATES
+# define NOSYSCOMMANDS
+# define NORASTEROPS
+# define NOSHOWWINDOW
+# define OEMRESOURCE
+# define NOATOM
+# define NOCLIPBOARD
+# define NOCOLOR
+# define NOCTLMGR
+# define NODRAWTEXT
+# define NOGDI
+# define NOKERNEL
+# define NOMB
+# define NOMEMMGR
+# define NOMETAFILE
+# define NOMINMAX
+# define NOOPENFILE
+# define NOSCROLL
+# define NOSERVICE
+# define NOSOUND
+# define NOTEXTMETRIC
+# define NOWH
+# define NOWINOFFSETS
+# define NOCOMM
+# define NOKANJI
+# define NOHELP
+# define NOPROFILER
+# define NODEFERWINDOWPOS
+# define NOMCX
+# ifndef NOCRYPT
+# define NOCRYPT
+# endif
# define WIN32_LEAN_AND_MEAN 1
#endif /*_WIN32*/
@@ -50,7 +89,9 @@ typedef __int32 ssize_t;
#ifdef _WIN32
# define SIZE_T_FMT "%Iu"
# define PTR_FMT "0x%p"
-# define snprintf sprintf_s
+# if _MSC_VER < 1900
+# define snprintf sprintf_s
+# endif
#else /*!_WIN32*/
# define SIZE_T_FMT "%zu"
# define PTR_FMT "%p"