From 2c6bcfbf8d2747c9c18a12e1ee0e21628610a94f Mon Sep 17 00:00:00 2001
From: foreman
Date: Thu, 17 Nov 2016 17:25:47 -0500
Subject: [PATCH] P4 to Git Change 1342976 by todli@todli-win-opencl-kv1 on
2016/11/17 17:13:47
SWDEV-107271 - [OpenCL][GFXIP9 Bring up] add support for Raven(gfx901)
Review: http://ocltc.amd.com/reviews/r/11809/
Affected files ...
... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/common/linker.cpp#154 edit
... //depot/stg/opencl/drivers/opencl/compiler/lib/loaders/bif/amuabi/amuABI.h#19 edit
... //depot/stg/opencl/drivers/opencl/compiler/lib/loaders/bif/amuabi/amuABIMultiBinary.cpp#19 edit
... //depot/stg/opencl/drivers/opencl/compiler/lib/utils/v0_8/libUtils.cpp#22 edit
... //depot/stg/opencl/drivers/opencl/compiler/lib/utils/v0_8/target_mappings.h#49 edit
... //depot/stg/opencl/drivers/opencl/compiler/lib/utils/v0_8/target_mappings_hsail.h#40 edit
... //depot/stg/opencl/drivers/opencl/compiler/lib/utils/v0_8/target_mappings_hsail64.h#35 edit
... //depot/stg/opencl/drivers/opencl/compiler/tools/driver/driver.cpp#65 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpudefs.hpp#144 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpudevice.cpp#559 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpusettings.cpp#348 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gslbe/src/rt/GSLDevice.cpp#176 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gslbe/src/rt/caltarget.h#4 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/paldefs.hpp#14 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/paldevice.cpp#35 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palsettings.cpp#11 edit
... //depot/stg/opencl/drivers/opencl/tests/ocltst/module/binary/BIFEnumCheck.cpp#26 edit
... //depot/stg/opencl/drivers/opencl/tests/ocltst/module/math/OCLMathFunc.cpp#28 edit
... //depot/stg/opencl/drivers/opencl/tests/ocltst/module/runtime/OCLDeviceQueries.cpp#42 edit
... //depot/stg/opencl/drivers/opencl/tests/ocltst/module/runtime/OCLOfflineCompilation.cpp#18 edit
... //depot/stg/opencl/drivers/opencl/tests/ocltst/module/runtime/OCLPerfCounters.cpp#35 edit
---
rocclr/compiler/lib/backends/common/linker.cpp | 3 ++-
rocclr/compiler/lib/utils/v0_8/libUtils.cpp | 5 +++++
rocclr/compiler/lib/utils/v0_8/target_mappings.h | 2 +-
rocclr/compiler/lib/utils/v0_8/target_mappings_hsail.h | 3 +++
rocclr/compiler/lib/utils/v0_8/target_mappings_hsail64.h | 3 +++
rocclr/runtime/device/gpu/gpudefs.hpp | 1 +
rocclr/runtime/device/gpu/gpudevice.cpp | 1 +
rocclr/runtime/device/gpu/gpusettings.cpp | 3 +++
rocclr/runtime/device/gpu/gslbe/src/rt/GSLDevice.cpp | 4 ++++
rocclr/runtime/device/gpu/gslbe/src/rt/caltarget.h | 3 ++-
rocclr/runtime/device/pal/paldefs.hpp | 3 +++
rocclr/runtime/device/pal/paldevice.cpp | 7 ++++++-
rocclr/runtime/device/pal/palsettings.cpp | 9 +++++----
13 files changed, 39 insertions(+), 8 deletions(-)
diff --git a/rocclr/compiler/lib/backends/common/linker.cpp b/rocclr/compiler/lib/backends/common/linker.cpp
index e2b33830b3..d1d1604882 100644
--- a/rocclr/compiler/lib/backends/common/linker.cpp
+++ b/rocclr/compiler/lib/backends/common/linker.cpp
@@ -582,7 +582,8 @@ amdcl::OCLLinker::link(llvm::Module* input, std::vectorgetContext().setAMDLLVMContextHook(&hookup_);
diff --git a/rocclr/compiler/lib/utils/v0_8/libUtils.cpp b/rocclr/compiler/lib/utils/v0_8/libUtils.cpp
index 42a45ff36a..3ae71322a0 100644
--- a/rocclr/compiler/lib/utils/v0_8/libUtils.cpp
+++ b/rocclr/compiler/lib/utils/v0_8/libUtils.cpp
@@ -585,6 +585,11 @@ int getIsaType(const aclTargetInfo *target)
default: return 900;
case AI_GREENLAND_P_A0: return 900;
}
+ case FAMILY_RV:
+ switch (Mapping.chip_enum) {
+ default: return 901;
+ case RAVEN_A0: return 901;
+ }
}
}
diff --git a/rocclr/compiler/lib/utils/v0_8/target_mappings.h b/rocclr/compiler/lib/utils/v0_8/target_mappings.h
index a7be39f755..5b86ccd4de 100644
--- a/rocclr/compiler/lib/utils/v0_8/target_mappings.h
+++ b/rocclr/compiler/lib/utils/v0_8/target_mappings.h
@@ -206,7 +206,7 @@ static const char* calTargetMapping[] = {
"Hainan", "Hawaii",
"Iceland", "Tonga", "Mullins", "Fiji",
"Carrizo", "Ellesmere", "Baffin",
- "gfx900", "Stoney", "gfx804",
+ "gfx900", "Stoney", "gfx804", "gfx901",
};
#include "utils/v0_8/target_mappings_amdil.h"
diff --git a/rocclr/compiler/lib/utils/v0_8/target_mappings_hsail.h b/rocclr/compiler/lib/utils/v0_8/target_mappings_hsail.h
index 47fa56fcaf..6d5df7b195 100644
--- a/rocclr/compiler/lib/utils/v0_8/target_mappings_hsail.h
+++ b/rocclr/compiler/lib/utils/v0_8/target_mappings_hsail.h
@@ -9,6 +9,7 @@
#include "inc/asic_reg/ci_id.h"
#include "inc/asic_reg/cz_id.h"
#include "inc/asic_reg/ai_id.h"
+#include "inc/asic_reg/rv_id.h"
#include "inc/asic_reg/atiid.h"
static const TargetMapping HSAILTargetMapping_0_8[] = {
@@ -32,6 +33,8 @@ static const TargetMapping HSAILTargetMapping_0_8[] = {
{ "VI", "Ellesmere", "GFX8", amd::GPU_Library_HSAIL, VI_ELLESMERE_P_A0, F_VI_BASE, true, true, FAMILY_VI },
{ "AI", "gfx900", "GFX9", amd::GPU_Library_HSAIL, AI_GREENLAND_P_A0, F_AI_BASE, true, true, FAMILY_AI },
{ "VI", "gfx804", "GFX8", amd::GPU_Library_HSAIL, VI_LEXA_V_A0, F_VI_BASE, true, true, FAMILY_VI },
+
+ UnknownTarget,
InvalidTarget
};
diff --git a/rocclr/compiler/lib/utils/v0_8/target_mappings_hsail64.h b/rocclr/compiler/lib/utils/v0_8/target_mappings_hsail64.h
index f2ab80d60b..98b0dab4d4 100644
--- a/rocclr/compiler/lib/utils/v0_8/target_mappings_hsail64.h
+++ b/rocclr/compiler/lib/utils/v0_8/target_mappings_hsail64.h
@@ -8,6 +8,7 @@
#include "inc/asic_reg/kv_id.h"
#include "inc/asic_reg/ci_id.h"
#include "inc/asic_reg/ai_id.h"
+#include "inc/asic_reg/rv_id.h"
#include "inc/asic_reg/atiid.h"
static const TargetMapping HSAIL64TargetMapping_0_8[] = {
@@ -31,6 +32,8 @@ static const TargetMapping HSAIL64TargetMapping_0_8[] = {
{ "VI", "Ellesmere", "GFX8", amd::GPU_Library_HSAIL, VI_ELLESMERE_P_A0, F_VI_BASE, true, true, FAMILY_VI },
{ "AI", "gfx900", "GFX9", amd::GPU_Library_HSAIL, AI_GREENLAND_P_A0, F_AI_BASE, true, true, FAMILY_AI },
{ "VI", "gfx804", "GFX8", amd::GPU_Library_HSAIL, VI_LEXA_V_A0, F_VI_BASE, true, true, FAMILY_VI },
+
+ UnknownTarget,
InvalidTarget
};
diff --git a/rocclr/runtime/device/gpu/gpudefs.hpp b/rocclr/runtime/device/gpu/gpudefs.hpp
index 1e62dd4386..6bfdc6ef0e 100644
--- a/rocclr/runtime/device/gpu/gpudefs.hpp
+++ b/rocclr/runtime/device/gpu/gpudefs.hpp
@@ -128,6 +128,7 @@ static const AMDDeviceInfo DeviceInfo[] = {
/* CAL_TARGET_GREENLAND */ { ED_ATI_CAL_MACHINE_GREENLAND_ISA, "gfx900", "gfx900", 4, 16, 1, 256, 64 * Ki, 32, 900 },
/* 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 },
};
enum gfx_handle {
diff --git a/rocclr/runtime/device/gpu/gpudevice.cpp b/rocclr/runtime/device/gpu/gpudevice.cpp
index 04b2ae9706..6e20ca09c2 100644
--- a/rocclr/runtime/device/gpu/gpudevice.cpp
+++ b/rocclr/runtime/device/gpu/gpudevice.cpp
@@ -155,6 +155,7 @@ NullDevice::create(CALtarget target)
case CAL_TARGET_GREENLAND:
case CAL_TARGET_STONEY:
case CAL_TARGET_LEXA:
+ case CAL_TARGET_RAVEN:
calAttr.doublePrecision = CAL_TRUE;
calAttr.isOpenCL200Device = CAL_TRUE;
break;
diff --git a/rocclr/runtime/device/gpu/gpusettings.cpp b/rocclr/runtime/device/gpu/gpusettings.cpp
index caba9cf5cc..c90e2f5867 100644
--- a/rocclr/runtime/device/gpu/gpusettings.cpp
+++ b/rocclr/runtime/device/gpu/gpusettings.cpp
@@ -167,6 +167,9 @@ Settings::create(
ModifyMaxWorkload modifyMaxWorkload = {0};
switch (target) {
+ case CAL_TARGET_RAVEN:
+ // APU systems for AI
+ apuSystem_ = true;
case CAL_TARGET_GREENLAND:
//TODO: specific codes for AI
aiPlus_ = true;
diff --git a/rocclr/runtime/device/gpu/gslbe/src/rt/GSLDevice.cpp b/rocclr/runtime/device/gpu/gslbe/src/rt/GSLDevice.cpp
index 2b0f6a2a90..40a5cbd1cf 100644
--- a/rocclr/runtime/device/gpu/gslbe/src/rt/GSLDevice.cpp
+++ b/rocclr/runtime/device/gpu/gslbe/src/rt/GSLDevice.cpp
@@ -505,6 +505,10 @@ CALGSLDevice::SetupContext(int32 &asic_id)
m_target = CAL_TARGET_LEXA;
m_elfmachine = ED_ATI_CAL_MACHINE_LEXA_ISA;
break;
+ case GSL_ATIASIC_ID_RAVEN:
+ m_target = CAL_TARGET_RAVEN;
+ m_elfmachine = ED_ATI_CAL_MACHINE_RAVEN_ISA;
+ break;
default:
// 6XX is not supported
m_adp->deleteContext(temp_cs);
diff --git a/rocclr/runtime/device/gpu/gslbe/src/rt/caltarget.h b/rocclr/runtime/device/gpu/gslbe/src/rt/caltarget.h
index c6053e258a..0ef16010ee 100644
--- a/rocclr/runtime/device/gpu/gslbe/src/rt/caltarget.h
+++ b/rocclr/runtime/device/gpu/gslbe/src/rt/caltarget.h
@@ -46,7 +46,8 @@ typedef enum CALtargetEnum {
CAL_TARGET_GREENLAND, /**< GREENLAND GPU ISA*/
CAL_TARGET_STONEY, /**< STONEY GPU ISA*/
CAL_TARGET_LEXA, /**< LEXA GPU ISA*/
- CAL_TARGET_LAST = CAL_TARGET_LEXA, /**< last */
+ CAL_TARGET_RAVEN, /**< RAVEN GPU ISA*/
+ CAL_TARGET_LAST = CAL_TARGET_RAVEN, /**< last */
//##END_PRIVATE##
} CALtarget;
diff --git a/rocclr/runtime/device/pal/paldefs.hpp b/rocclr/runtime/device/pal/paldefs.hpp
index 421bf3115a..9e38daada4 100644
--- a/rocclr/runtime/device/pal/paldefs.hpp
+++ b/rocclr/runtime/device/pal/paldefs.hpp
@@ -156,6 +156,9 @@ static const AMDDeviceInfo GfxIpDeviceInfo[] = {
/* GFX900 */ { "gfx900", "gfx900", 4, 16, 1, 256, 64 * Ki, 32, 900 },
};
+static const AMDDeviceInfo Gfx901DeviceInfo =
+/* GFX901 */ { "gfx901", "gfx901", 4, 16, 1, 256, 64 * Ki, 32, 901 };
+
enum gfx_handle {
gfx700 = 700,
gfx701 = 701,
diff --git a/rocclr/runtime/device/pal/paldevice.cpp b/rocclr/runtime/device/pal/paldevice.cpp
index 9b1dd982ae..2d36aa0290 100644
--- a/rocclr/runtime/device/pal/paldevice.cpp
+++ b/rocclr/runtime/device/pal/paldevice.cpp
@@ -700,7 +700,12 @@ Device::create(Pal::IDevice* device)
hwInfo_ = &DeviceInfo[static_cast(properties().revision)];
}
else if (ipLevel_ >= Pal::GfxIpLevel::GfxIp9) {
- hwInfo_ = &GfxIpDeviceInfo[static_cast(ipLevel_)];
+ if (properties().gpuType == Pal::GpuType::Integrated) {
+ hwInfo_ = &Gfx901DeviceInfo;
+ }
+ else {
+ hwInfo_ = &GfxIpDeviceInfo[static_cast(ipLevel_)];
+ }
}
else {
return false;
diff --git a/rocclr/runtime/device/pal/palsettings.cpp b/rocclr/runtime/device/pal/palsettings.cpp
index 44f47a418c..7df2023cbb 100644
--- a/rocclr/runtime/device/pal/palsettings.cpp
+++ b/rocclr/runtime/device/pal/palsettings.cpp
@@ -163,6 +163,11 @@ Settings::create(
// Update GPU specific settings and info structure if we have any
ModifyMaxWorkload modifyMaxWorkload = {0};
+ // APU systems
+ if (palProp.gpuType == Pal::GpuType::Integrated) {
+ apuSystem_ = true;
+ }
+
switch (palProp.revision) {
case Pal::AsicRevision::Unknown:
switch (palProp.gfxLevel) {
@@ -177,8 +182,6 @@ Settings::create(
case Pal::AsicRevision::Carrizo:
case Pal::AsicRevision::Stoney:
if (!aiPlus_) {
- // APU systems for VI
- apuSystem_ = true;
// Fix BSOD/TDR issues observed on Stoney Win7/8.1/10
minWorkloadTime_ = 1000;
modifyMaxWorkload.time = 1000; // Decided by experiment
@@ -204,8 +207,6 @@ Settings::create(
case Pal::AsicRevision::Kalindi:
case Pal::AsicRevision::Spectre:
if (!viPlus_) {
- // APU systems for CI
- apuSystem_ = true;
// Fix BSOD/TDR issues observed on Kaveri Win7 (EPR#416903)
modifyMaxWorkload.time = 250000; // 250ms
modifyMaxWorkload.minorVersion = 1; // Win 7