From 45497b47ddb83cb924d7b096cbaef0dc8ea2671e Mon Sep 17 00:00:00 2001
From: foreman
Date: Fri, 18 Jul 2014 06:05:30 -0400
Subject: [PATCH] P4 to Git Change 1056683 by emankov@em-hsa-amd on 2014/07/18
05:59:08
ECR #333753 - Compiler Lib: use Callback() instead of cout
Testing: smoke_clang, pre check-in
Reviewer: Brian Sumner
Affected files ...
... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/common/v0_8/if_acl.cpp#39 edit
---
.../lib/backends/common/v0_8/if_acl.cpp | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 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 a5b4b862e2..152de3196a 100644
--- a/rocclr/compiler/lib/backends/common/v0_8/if_acl.cpp
+++ b/rocclr/compiler/lib/backends/common/v0_8/if_acl.cpp
@@ -1276,21 +1276,26 @@ internal_compile_failure:
#define CONDITIONAL_CMP_ASSIGN(A, B, C) A = (A && B != A) ? (A) : (C)
acl_error
-IsValidCompilationOptions(aclBinary *bin)
+IsValidCompilationOptions(aclBinary *bin, aclLogFunction compile_callback)
{
+ acl_error error_code = ACL_SUCCESS;
#if defined(WITH_TARGET_HSAIL) && defined(WITH_TARGET_AMDIL)
amd::option::Options* opts = reinterpret_cast(bin->options);
std::string major = std::string(opts->oVariables->CLStd).substr(2,1);
+ std::string error_msg;
if (isHSAILTarget(bin->target) && major == "1") {
- std::cout << "Error: HSAIL doesn't support OpenCL version < 2.0" << std::endl;
- return ACL_INVALID_OPTION;
+ error_msg = "Error: HSAIL doesn't support OpenCL version < 2.0.";
+ error_code = ACL_INVALID_OPTION;
}
if (isAMDILTarget(bin->target) && major == "2") {
- std::cout << "Error: AMDIL doesn't support OpenCL version >= 2.0" << std::endl;
- return ACL_INVALID_OPTION;
+ error_msg = "Error: AMDIL doesn't support OpenCL version >= 2.0.";
+ error_code = ACL_INVALID_OPTION;
+ }
+ if (ACL_SUCCESS != error_code && compile_callback) {
+ compile_callback(error_msg.c_str(), error_msg.size());
}
#endif
- return ACL_SUCCESS;
+ return error_code;
}
acl_error ACL_API_ENTRY
@@ -1304,7 +1309,7 @@ if_aclCompile(aclCompiler *cl,
if (bin == NULL || cl == NULL) {
return ACL_INVALID_ARG;
}
- acl_error error_code = IsValidCompilationOptions(bin);
+ acl_error error_code = IsValidCompilationOptions(bin, compile_callback);
if (error_code != ACL_SUCCESS) {
return error_code;
}