From 463b3cd876ab007e241d1b7505f031edbac8af30 Mon Sep 17 00:00:00 2001
From: foreman
Date: Mon, 3 Dec 2018 15:06:55 -0500
Subject: [PATCH] P4 to Git Change 1715236 by axie@axie_win_opencl_laptop on
2018/12/03 14:48:51
SWDEV-165045 - Linux-Pro System Hard-Hang with Call Trace and VM Faults are observed while running ABAQUS-2018-OpenCL Sample on VEGA GPU
"-g" option caused shader compiler generated isa code which caused the VM fault. The root cause is still unknown. "-g" is not a feature for end user. So remove it.
Remove -g options from application. The affected API includes build, link and compile CL C kernel code.
Update ocltst compiler test to remove one test which uses "-g"
AMD_OCL_BUILD_OPTIONS_APPEND can be used to force "-g" option
Test:
Run the Abaqus as specfied in the JIRA twice. No VM fault.
In a simple OpenCL test application, driver can handle build option "-g -cl-mad-enable -g -D DDBUILD -D ok-g -g" correctly.
Teamcity test.
http://ocltc.amd.com:8111/viewModification.html?modId=112334&personal=true&buildTypeId=&tab=vcsModificationBuilds&show_all_builds=true
No new failure.
ReviewBoard: http://ocltc.amd.com/reviews/r/16255/
Affected files ...
... //depot/stg/opencl/drivers/opencl/runtime/platform/program.cpp#98 edit
... //depot/stg/opencl/drivers/opencl/tests/ocltst/module/compiler/OCLSeparateCompile.cpp#17 edit
---
rocclr/runtime/platform/program.cpp | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/rocclr/runtime/platform/program.cpp b/rocclr/runtime/platform/program.cpp
index 6dd40e50aa..1ed90954aa 100644
--- a/rocclr/runtime/platform/program.cpp
+++ b/rocclr/runtime/platform/program.cpp
@@ -19,6 +19,24 @@
namespace amd {
+static void remove_g_option(std::string &option)
+{
+ // Remove " -g " option from application.
+ // People can still add -g in AMD_OCL_BUILD_OPTIONS_APPEND, if it is so desired.
+ std::string g_str("-g");
+ std::size_t g_pos = 0;
+ while ((g_pos = option.find(g_str, g_pos)) != std::string::npos) {
+ if ((g_pos == 0 || option[g_pos - 1] == ' ') &&
+ (g_pos + 2 == option.size() || option[g_pos + 2] == ' ')) {
+ option.erase(g_pos, g_str.size());
+ } else {
+ g_pos += g_str.size();
+ }
+ }
+
+ return;
+}
+
Program::~Program() {
// Destroy all device programs
for (const auto& it : devicePrograms_) {
@@ -185,6 +203,7 @@ cl_int Program::compile(const std::vector& devices, size_t numHeaders,
cppstr = cppstr.substr(pos + sizeof("-ignore-env"));
optionChangable = false;
}
+ remove_g_option(cppstr);
}
option::Options parsedOptions;
if (!ParseAllOptions(cppstr, parsedOptions, optionChangable)) {
@@ -269,6 +288,7 @@ cl_int Program::link(const std::vector& devices, size_t numInputs,
cppstr = cppstr.substr(pos + sizeof("-ignore-env"));
optionChangable = false;
}
+ remove_g_option(cppstr);
}
option::Options parsedOptions;
if (!ParseAllOptions(cppstr, parsedOptions, optionChangable, true)) {
@@ -460,6 +480,7 @@ cl_int Program::build(const std::vector& devices, const char* options,
cppstr = cppstr.substr(pos + sizeof("-ignore-env"));
optionChangable = false;
}
+ remove_g_option(cppstr);
}
option::Options parsedOptions;
if (!ParseAllOptions(cppstr, parsedOptions, optionChangable)) {