From 41f5fd45af79571ab15a9145f9841e1e772d036e Mon Sep 17 00:00:00 2001
From: foreman
Date: Thu, 15 Feb 2018 08:12:32 -0500
Subject: [PATCH] P4 to Git Change 1516358 by emankov@em-hsa on 2018/02/15
08:04:51
SWDEV-143465 - Revert of #1516121
[Reason]
A plenty of tests are failed.
After the changing stack logic a lot of tests should be fixed, a lot - to be removed from testing.
#1516121 will be submitted again after renewal/removal of all the failed tests.
Affected files ...
... //depot/stg/opencl/drivers/opencl/compiler/legacy-lib/backends/common/v0_8/if_acl.cpp#10 edit
... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/common/v0_8/if_acl.cpp#98 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpudevice.cpp#583 edit
[ROCm/clr commit: f63eb0e998e87472c605697066957adb74ea2725]
---
.../lib/backends/common/v0_8/if_acl.cpp | 43 +++----------------
.../rocclr/runtime/device/gpu/gpudevice.cpp | 7 ++-
2 files changed, 13 insertions(+), 37 deletions(-)
diff --git a/projects/clr/rocclr/compiler/lib/backends/common/v0_8/if_acl.cpp b/projects/clr/rocclr/compiler/lib/backends/common/v0_8/if_acl.cpp
index a78e58a3b6..c491d8f2c9 100644
--- a/projects/clr/rocclr/compiler/lib/backends/common/v0_8/if_acl.cpp
+++ b/projects/clr/rocclr/compiler/lib/backends/common/v0_8/if_acl.cpp
@@ -1425,47 +1425,18 @@ 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/projects/clr/rocclr/runtime/device/gpu/gpudevice.cpp b/projects/clr/rocclr/runtime/device/gpu/gpudevice.cpp
index 8ef1985cc4..686d4a714b 100644
--- a/projects/clr/rocclr/runtime/device/gpu/gpudevice.cpp
+++ b/projects/clr/rocclr/runtime/device/gpu/gpudevice.cpp
@@ -242,6 +242,7 @@ 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;
@@ -269,6 +270,10 @@ 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
@@ -291,7 +296,7 @@ bool NullDevice::isHsailProgram(amd::option::Options* options) {
if (isSPIRV || (isBlit && isCIPlus && isHSAILcapable) || isClang || isOCL20) {
return true;
}
- if (isLegacy || !isHSAILcapable || isEDG) {
+ if (isLegacy || !isHSAILcapable || isEDG || isLangExt) {
return false;
}
return true;