From 978163569f599e9b002145d6bd8c2a9459c246f5 Mon Sep 17 00:00:00 2001
From: foreman
Date: Thu, 5 Jan 2017 12:05:03 -0500
Subject: [PATCH] P4 to Git Change 1358812 by asalmanp@asalmanp-opencl-stg on
2017/01/05 11:55:44
SWDEV-109077 - [Polaris22][OCL] Add Driver Support for Polaris22(gfx8). Polaris22 is yet another new gfx8 ASIC and should follow ELM/BFN/Lexa code path.
ReviewBoardURL = http://ocltc.amd.com/reviews/r/12114/
Affected files ...
... //depot/stg/opencl/drivers/opencl/compiler/legacy-lib/backends/gpu/scwrapper/SI/devStateSI.cpp#3 edit
... //depot/stg/opencl/drivers/opencl/compiler/legacy-lib/backends/gpu/scwrapper/devState.cpp#4 edit
... //depot/stg/opencl/drivers/opencl/compiler/legacy-lib/backends/gpu/scwrapper/scCompileBase.cpp#4 edit
... //depot/stg/opencl/drivers/opencl/compiler/legacy-lib/loaders/bif/amuabi/amuABI.h#4 edit
... //depot/stg/opencl/drivers/opencl/compiler/legacy-lib/loaders/bif/amuabi/amuABIMultiBinary.cpp#4 edit
... //depot/stg/opencl/drivers/opencl/compiler/lib/loaders/bif/amuabi/amuABI.h#20 edit
... //depot/stg/opencl/drivers/opencl/compiler/lib/loaders/bif/amuabi/amuABIMultiBinary.cpp#20 edit
... //depot/stg/opencl/drivers/opencl/compiler/lib/utils/v0_8/libUtils.cpp#24 edit
... //depot/stg/opencl/drivers/opencl/compiler/llvm32/lib/Target/AMDIL/AMDIL.h#7 edit
... //depot/stg/opencl/drivers/opencl/compiler/llvm32/lib/Target/AMDIL/AMDILSubtarget.cpp#11 edit
... //depot/stg/opencl/drivers/opencl/compiler/llvm32/lib/Target/AMDIL/Internal/AMDILInternalDeviceFlags.h#6 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpudefs.hpp#145 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpudevice.cpp#562 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuprogram.cpp#230 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpusettings.cpp#349 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gslbe/src/rt/GSLDevice.cpp#179 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gslbe/src/rt/caltarget.h#5 edit
... //depot/stg/opencl/drivers/opencl/tests/ocltst/module/binary/BIFEnumCheck.cpp#27 edit
---
rocclr/compiler/lib/utils/v0_8/libUtils.cpp | 1 +
rocclr/runtime/device/gpu/gpudefs.hpp | 1 +
rocclr/runtime/device/gpu/gpudevice.cpp | 1 +
rocclr/runtime/device/gpu/gpuprogram.cpp | 1 +
rocclr/runtime/device/gpu/gpusettings.cpp | 1 +
rocclr/runtime/device/gpu/gslbe/src/rt/GSLDevice.cpp | 6 +++++-
rocclr/runtime/device/gpu/gslbe/src/rt/caltarget.h | 3 ++-
7 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/rocclr/compiler/lib/utils/v0_8/libUtils.cpp b/rocclr/compiler/lib/utils/v0_8/libUtils.cpp
index 4b61143651..5787b47c56 100644
--- a/rocclr/compiler/lib/utils/v0_8/libUtils.cpp
+++ b/rocclr/compiler/lib/utils/v0_8/libUtils.cpp
@@ -568,6 +568,7 @@ int getIsaType(const aclTargetInfo *target)
case VI_BAFFIN_M_A0:
case VI_ELLESMERE_P_A0:
case VI_LEXA_V_A0:
+ case VI_POLARIS22_P_A0:
#if defined(BUILD_HSA_TARGET)
return 803; // Special case - Boltzmann FIJI, BAFFIN, ELLESMERE, LEXA
// Otherwise fall through
diff --git a/rocclr/runtime/device/gpu/gpudefs.hpp b/rocclr/runtime/device/gpu/gpudefs.hpp
index 6bfdc6ef0e..9bdbd0b5b7 100644
--- a/rocclr/runtime/device/gpu/gpudefs.hpp
+++ b/rocclr/runtime/device/gpu/gpudefs.hpp
@@ -129,6 +129,7 @@ static const AMDDeviceInfo DeviceInfo[] = {
/* CAL_TARGET_STONEY */ { ED_ATI_CAL_MACHINE_STONEY_ISA, "Stoney", "stoney", 4, 16, 1, 256, 64 * Ki, 32, 800 },
/* CAL_TARGET_LEXA */ { ED_ATI_CAL_MACHINE_LEXA_ISA, "gfx804", "gfx804", 4, 16, 1, 256, 64 * Ki, 32, 800 },
/* CAL_TARGET_RAVEN */ { ED_ATI_CAL_MACHINE_RAVEN_ISA, "gfx901", "gfx901", 4, 16, 1, 256, 64 * Ki, 32, 900 },
+/* CAL_TARGET_POLARIS22 */ { ED_ATI_CAL_MACHINE_POLARIS22_ISA, "gfx804", "gfx804", 4, 16, 1, 256, 64 * Ki, 32, 800 },
};
enum gfx_handle {
diff --git a/rocclr/runtime/device/gpu/gpudevice.cpp b/rocclr/runtime/device/gpu/gpudevice.cpp
index e5c0b942a8..440c31db8a 100644
--- a/rocclr/runtime/device/gpu/gpudevice.cpp
+++ b/rocclr/runtime/device/gpu/gpudevice.cpp
@@ -156,6 +156,7 @@ NullDevice::create(CALtarget target)
case CAL_TARGET_STONEY:
case CAL_TARGET_LEXA:
case CAL_TARGET_RAVEN:
+ case CAL_TARGET_POLARIS22:
calAttr.doublePrecision = CAL_TRUE;
calAttr.isOpenCL200Device = CAL_TRUE;
break;
diff --git a/rocclr/runtime/device/gpu/gpuprogram.cpp b/rocclr/runtime/device/gpu/gpuprogram.cpp
index 64241ed22f..9bdaf3f262 100644
--- a/rocclr/runtime/device/gpu/gpuprogram.cpp
+++ b/rocclr/runtime/device/gpu/gpuprogram.cpp
@@ -2391,6 +2391,7 @@ bool ORCAHSALoaderContext::IsaSupportedByAgent(hsa_agent_t agent, hsa_isa_t isa)
case ED_ATI_CAL_MACHINE_ELLESMERE_ISA:
case ED_ATI_CAL_MACHINE_BAFFIN_ISA:
case ED_ATI_CAL_MACHINE_LEXA_ISA:
+ case ED_ATI_CAL_MACHINE_POLARIS22_ISA:
// gfx800 ISA has only sgrps limited and can be loaded.
// gfx801 ISA has XNACK limitations and can be loaded.
return isa.handle == gfx800 || isa.handle == gfx801 || isa.handle == gfx804;
diff --git a/rocclr/runtime/device/gpu/gpusettings.cpp b/rocclr/runtime/device/gpu/gpusettings.cpp
index c90e2f5867..b303f45092 100644
--- a/rocclr/runtime/device/gpu/gpusettings.cpp
+++ b/rocclr/runtime/device/gpu/gpusettings.cpp
@@ -195,6 +195,7 @@ Settings::create(
case CAL_TARGET_ELLESMERE:
case CAL_TARGET_BAFFIN:
case CAL_TARGET_LEXA:
+ case CAL_TARGET_POLARIS22:
// Disable tiling aperture on VI+
linearPersistentImage_ = true;
// Keep this false even though we have support
diff --git a/rocclr/runtime/device/gpu/gslbe/src/rt/GSLDevice.cpp b/rocclr/runtime/device/gpu/gslbe/src/rt/GSLDevice.cpp
index 787ff98597..01db5f1729 100644
--- a/rocclr/runtime/device/gpu/gslbe/src/rt/GSLDevice.cpp
+++ b/rocclr/runtime/device/gpu/gslbe/src/rt/GSLDevice.cpp
@@ -509,7 +509,11 @@ CALGSLDevice::SetupContext(int32 &asic_id)
m_target = CAL_TARGET_RAVEN;
m_elfmachine = ED_ATI_CAL_MACHINE_RAVEN_ISA;
break;
- default:
+ case GSL_ATIASIC_ID_POLARIS22:
+ m_target = CAL_TARGET_POLARIS22;
+ m_elfmachine = ED_ATI_CAL_MACHINE_POLARIS22_ISA;
+ break;
+ default:
// 6XX is not supported
m_adp->deleteContext(temp_cs);
gsAdaptor::closeAdaptor(m_adp);
diff --git a/rocclr/runtime/device/gpu/gslbe/src/rt/caltarget.h b/rocclr/runtime/device/gpu/gslbe/src/rt/caltarget.h
index 0ef16010ee..ca3bb2c7cf 100644
--- a/rocclr/runtime/device/gpu/gslbe/src/rt/caltarget.h
+++ b/rocclr/runtime/device/gpu/gslbe/src/rt/caltarget.h
@@ -47,7 +47,8 @@ typedef enum CALtargetEnum {
CAL_TARGET_STONEY, /**< STONEY GPU ISA*/
CAL_TARGET_LEXA, /**< LEXA GPU ISA*/
CAL_TARGET_RAVEN, /**< RAVEN GPU ISA*/
- CAL_TARGET_LAST = CAL_TARGET_RAVEN, /**< last */
+ CAL_TARGET_POLARIS22, /**< POLARIS22 GPU ISA*/
+ CAL_TARGET_LAST = CAL_TARGET_POLARIS22, /**< last */
//##END_PRIVATE##
} CALtarget;