From 9a85405b0b3651bc075ba0f89d8dc244b90ba98d Mon Sep 17 00:00:00 2001
From: foreman
Date: Wed, 14 Feb 2018 13:36:18 -0500
Subject: [PATCH] P4 to Git Change 1516121 by emankov@em-hsa on 2018/02/14
13:29:20
SWDEV-143465 - Stop building static C++ kernels on CI+
Changed stack logic:
1. Stop supporting AMDIL on CI+ devices: "AMDIL doesn't support device ..." will be reported.
2. Stop handling OpenCL extension options in RT: if "-x spir" or "-x clc++" option is specified, it wouldn't force legacy AMDIL compiler anymore.
3. Start reporting error on "-legacy" option in HSAIL compiler. If we reach HSAIL compiler, then it means that there are conflicting options. Report them all, possible options are: -frontend=edg, -cl-std=CL2.0 (>= 2.0), -binary_is_spirv.
Already submitted changes in stack logic:
1. Start reporting error for SI devices on HSAIL path.
2. Start handling OpenCL extension options on HSAIL path: report error on "-x spir" or "-x clc++" options.
[Testing]
rga offline for all the targets supported by HSAIL and AMDIL (from Family_SI up to Family_VI):
tahiti, pitcairn, capeverde, spectre, spooky, kalindi, hawaii, oland, bonaire, hainan, carrizo, iceland, tonga, fiji, stoney, baffin, ellesmere.
[Reviewed] by German and Stas (http://ocltc.amd.com/reviews/r/14270)
Affected files ...
... //depot/stg/opencl/drivers/opencl/compiler/legacy-lib/backends/common/v0_8/if_acl.cpp#9 edit
... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/common/v0_8/if_acl.cpp#97 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpudevice.cpp#582 edit
---
.../lib/backends/common/v0_8/if_acl.cpp | 43 ++++++++++++++++---
rocclr/runtime/device/gpu/gpudevice.cpp | 7 +--
2 files changed, 37 insertions(+), 13 deletions(-)
diff --git a/rocclr/compiler/lib/backends/common/v0_8/if_acl.cpp b/rocclr/compiler/lib/backends/common/v0_8/if_acl.cpp
index c491d8f2c9..a78e58a3b6 100644
--- a/rocclr/compiler/lib/backends/common/v0_8/if_acl.cpp
+++ b/rocclr/compiler/lib/backends/common/v0_8/if_acl.cpp
@@ -1425,18 +1425,47 @@ IsValidCompilationOptions(aclBinary *bin, aclLogFunction compile_callback)
amd::option::Options* opts = reinterpret_cast(bin->options);
std::string error_msg;
if (isHSAILTarget(bin->target)) {
- if (opts->oVariables->XLang) {
- std::string ext = std::string(opts->oVariables->XLang);
- if (ext == "clc++" || ext == "spir") {
- error_msg = "Error: HSAIL doesn't support OpenCL extension " + ext + ".";
- error_code = ACL_INVALID_OPTION;
- }
- }
if (getFamilyEnum(&bin->target) == FAMILY_SI) {
std::string device = std::string(getDeviceName(bin->target));
error_msg = "Error: HSAIL doesn't support device " + device + ".";
error_code = ACL_INVALID_TARGET;
}
+ if (opts->oVariables->Legacy) {
+ if (error_msg.empty()) {
+ error_code = ACL_INVALID_OPTION;
+ }
+ else {
+ error_msg += "\n";
+ }
+ error_msg += "Error: AMDIL wasn't forced by -legacy option due to the following conflicting HSAIL only option(s):";
+ if (opts->oVariables->Frontend) {
+ std::string frontend = std::string(opts->oVariables->Frontend);
+ if (frontend == "clang") {
+ error_msg += " -frontend=clang";
+ }
+ }
+ if (opts->oVariables->CLStd) {
+ std::string sCL = std::string(opts->oVariables->CLStd);
+ std::string major = sCL.substr(2, 1);
+ if (std::stoul(major) >= 2) {
+ error_msg += " -cl-std=" + sCL;
+ }
+ }
+ if (opts->oVariables->BinaryIsSpirv) {
+ error_msg += " -binary_is_spirv";
+ }
+ }
+ if (opts->oVariables->XLang) {
+ std::string ext = std::string(opts->oVariables->XLang);
+ if (ext == "clc++" || ext == "spir") {
+ if (error_msg.empty()) {
+ error_code = ACL_INVALID_OPTION;
+ } else {
+ error_msg += "\n";
+ }
+ error_msg += "Error: HSAIL doesn't support OpenCL extension " + ext + ".";
+ }
+ }
}
if (ACL_SUCCESS != error_code && compile_callback) {
compile_callback(error_msg.c_str(), error_msg.size());
diff --git a/rocclr/runtime/device/gpu/gpudevice.cpp b/rocclr/runtime/device/gpu/gpudevice.cpp
index 686d4a714b..8ef1985cc4 100644
--- a/rocclr/runtime/device/gpu/gpudevice.cpp
+++ b/rocclr/runtime/device/gpu/gpudevice.cpp
@@ -242,7 +242,6 @@ bool NullDevice::isHsailProgram(amd::option::Options* options) {
bool isHSAILcapable = settings().hsail_;
bool isBlit = false;
bool isSPIRV = false;
- bool isLangExt = false;
bool isClang = false;
bool isEDG = false;
bool isLegacy = false;
@@ -270,10 +269,6 @@ bool NullDevice::isHsailProgram(amd::option::Options* options) {
if (!isLegacy) {
isLegacy = op->oVariables->Legacy;
}
- if (!isLangExt) {
- isLangExt = op->isCStrOptionsEqual(op->oVariables->XLang, "clc++") ||
- op->isCStrOptionsEqual(op->oVariables->XLang, "spir");
- }
// Checks Frontend option only from input *options, not from Env,
// because they might be only calculated by RT based on the binaries to link.
// -frontend is being queried now instead of -cl-std=CL2.0, because the last one
@@ -296,7 +291,7 @@ bool NullDevice::isHsailProgram(amd::option::Options* options) {
if (isSPIRV || (isBlit && isCIPlus && isHSAILcapable) || isClang || isOCL20) {
return true;
}
- if (isLegacy || !isHSAILcapable || isEDG || isLangExt) {
+ if (isLegacy || !isHSAILcapable || isEDG) {
return false;
}
return true;