From edd0c50de2fb188952da42a4e667995ceac08e0e Mon Sep 17 00:00:00 2001
From: foreman
Date: Thu, 21 Dec 2017 12:06:35 -0500
Subject: [PATCH] P4 to Git Change 1497365 by gandryey@gera-w8 on 2017/12/21
11:59:26
SWDEV-79445 - OCL generic changes and code clean-up
- Make sure PAL works under HSAIL compiler. Use targets switch between LC and HSAIL, until HSAIL implements the new targets.
Affected files ...
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/paldefs.hpp#29 edit
... //depot/stg/opencl/drivers/opencl/runtime/utils/macros.hpp#9 edit
---
rocclr/runtime/device/pal/paldefs.hpp | 15 ++++++++-------
rocclr/runtime/utils/macros.hpp | 3 +++
2 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/rocclr/runtime/device/pal/paldefs.hpp b/rocclr/runtime/device/pal/paldefs.hpp
index 6146c9ef11..99de1b00ad 100644
--- a/rocclr/runtime/device/pal/paldefs.hpp
+++ b/rocclr/runtime/device/pal/paldefs.hpp
@@ -140,19 +140,20 @@ static const AMDDeviceInfo DeviceInfo[] = {
/* Bristol */ {"Bristol Ridge", "carrizo", 4, 16, 1, 256, 64 * Ki, 32, 801},
/* Stoney */ {"Stoney", "stoney", 4, 16, 1, 256, 64 * Ki, 32, 810},
- /* Iceland */ {"Iceland", "iceland", 4, 16, 1, 256, 64 * Ki, 32, 802},
- /* Tonga */ {"Tonga", "tonga", 4, 16, 1, 256, 64 * Ki, 32, 802},
- /* Fiji */ {"Fiji", "fiji", 4, 16, 1, 256, 64 * Ki, 32, 803},
- /* Ellesmere */ {"Ellesmere", "ellesmere", 4, 16, 1, 256, 64 * Ki, 32, 803},
- /* Baffin */ {"Baffin", "baffin", 4, 16, 1, 256, 64 * Ki, 32, 803},
- /* Lexa */ {"gfx803", "gfx803", 4, 16, 1, 256, 64 * Ki, 32, 803},
+ /* Iceland */ {"Iceland", "iceland", 4, 16, 1, 256, 64 * Ki, 32, LIGHTNING_SWITCH(802, 800)},
+ /* Tonga */ {"Tonga", "tonga", 4, 16, 1, 256, 64 * Ki, 32, LIGHTNING_SWITCH(802, 800)},
+ /* Fiji */ {"Fiji", "fiji", 4, 16, 1, 256, 64 * Ki, 32, LIGHTNING_SWITCH(803, 804)},
+ /* Ellesmere */ {"Ellesmere", "ellesmere", 4, 16, 1, 256, 64 * Ki, 32, LIGHTNING_SWITCH(803, 804)},
+ /* Baffin */ {"Baffin", "baffin", 4, 16, 1, 256, 64 * Ki, 32, LIGHTNING_SWITCH(803, 804)},
+ /* Lexa */ {"gfx803", "gfx803", 4, 16, 1, 256, 64 * Ki, 32, LIGHTNING_SWITCH(803, 804)},
};
// Ordering as per AsicRevision# in //depot/stg/pal/inc/core/palDevice.h and
// http://confluence.amd.com/pages/viewpage.action?spaceKey=ASLC&title=AMDGPU+Target+Names
static const AMDDeviceInfo Gfx9PlusSubDeviceInfo[] = {
/* Vega10 */{"gfx900", "gfx900", 4, 16, 1, 256, 64 * Ki, 32, 900},
- /* Vega10 XNACK */{"gfx901", "gfx901", 4, 16, 1, 256, 64 * Ki, 32, 901},
+ /* Vega10 XNACK */{ LIGHTNING_SWITCH("gfx900","gfx901"), LIGHTNING_SWITCH("gfx900","gfx901"),
+ 4, 16, 1, 256, 64 * Ki, 32, LIGHTNING_SWITCH(900, 901)},
/* Vega12 */{"gfx904", "gfx904", 4, 16, 1, 256, 64 * Ki, 32, 904},
/* Vega12 XNACK */{"gfx905", "gfx905", 4, 16, 1, 256, 64 * Ki, 32, 905},
/* Vega20 */{ "", "", 4, 16, 1, 256, 64 * Ki, 32, 906},
diff --git a/rocclr/runtime/utils/macros.hpp b/rocclr/runtime/utils/macros.hpp
index b75f5be7de..576e44c78d 100644
--- a/rocclr/runtime/utils/macros.hpp
+++ b/rocclr/runtime/utils/macros.hpp
@@ -100,9 +100,11 @@
#ifdef WITH_LIGHTNING_COMPILER
#define LIGHTNING_ONLY(x) x
+#define NOT_LIGHTNING(x)
#define IS_LIGHTNING true
#else /* !WITH_LIGHTNING_COMPILER */
#define LIGHTNING_ONLY(x)
+#define NOT_LIGHTNING(x) x
#endif /* !WITH_LIGHTNING_COMPILER */
#ifndef IS_LINUX
@@ -127,6 +129,7 @@
#define IF_RIGHT(cond, x) IF_RIGHT_##cond(x)
#define IF(cond, x, y) IF_LEFT(cond, x) IF_RIGHT(cond, y)
+#define LIGHTNING_SWITCH(x, other) LIGHTNING_ONLY(x) NOT_LIGHTNING(other)
#define LINUX_SWITCH(x, other) LINUX_ONLY(x) NOT_LINUX(other)
#define MACOS_SWITCH(x, other) MACOS_ONLY(x) NOT_MACOS(other)
#define WINDOWS_SWITCH(x, other) WINDOWS_ONLY(x) NOT_WINDOWS(other)