From df9060dc930393d5eebd3cb7d3a15399d8dd5de4 Mon Sep 17 00:00:00 2001
From: foreman
Date: Fri, 16 Oct 2015 10:20:54 -0400
Subject: [PATCH] P4 to Git Change 1200677 by mbareghe@mbareghe_stg_win30 on
2015/10/16 10:11:30
SWDEV-78915 - SYCL - segfault building SPIR binary where the kernel name exceeds 255 characters - changed kernel/arg name type from char[] to string to avoid the 256 character limitation.
Affected files ...
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpukernel.cpp#304 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpukernel.hpp#122 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuprogram.cpp#211 edit
[ROCm/clr commit: fab877c56d483640d493d92bb30859f453efce05]
---
projects/clr/rocclr/runtime/device/gpu/gpukernel.cpp | 8 +++-----
projects/clr/rocclr/runtime/device/gpu/gpukernel.hpp | 2 +-
projects/clr/rocclr/runtime/device/gpu/gpuprogram.cpp | 4 ++--
3 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/projects/clr/rocclr/runtime/device/gpu/gpukernel.cpp b/projects/clr/rocclr/runtime/device/gpu/gpukernel.cpp
index b970cedada..288ae3bc61 100644
--- a/projects/clr/rocclr/runtime/device/gpu/gpukernel.cpp
+++ b/projects/clr/rocclr/runtime/device/gpu/gpukernel.cpp
@@ -144,7 +144,7 @@ expect(const std::string& str, size_t* pos, const std::string& sym)
}
bool
-getword(const std::string& str, size_t* pos, char* sym)
+getword(const std::string& str, size_t* pos, std::string& sym)
{
if (*pos == std::string::npos) {
return false;
@@ -155,9 +155,7 @@ getword(const std::string& str, size_t* pos, char* sym)
size_t count = posEnd - *pos;
if (count != 0) {
- if (!str.copy(sym, count, *pos)) {
- return false;
- }
+ sym = str.substr(*pos, count);
}
sym[count] = 0;
*pos = posEnd + 1;
@@ -2527,7 +2525,7 @@ NullKernel::parseArguments(const std::string& metaData, uint* uavRefCount)
break;
}
- char argName[256];
+ std::string argName;
// Save the argument type
arg.type_ = ArgState[i].type_;
diff --git a/projects/clr/rocclr/runtime/device/gpu/gpukernel.hpp b/projects/clr/rocclr/runtime/device/gpu/gpukernel.hpp
index 05db79aad9..c696e54657 100644
--- a/projects/clr/rocclr/runtime/device/gpu/gpukernel.hpp
+++ b/projects/clr/rocclr/runtime/device/gpu/gpukernel.hpp
@@ -75,7 +75,7 @@ bool expect(
bool getword(
const std::string& str, //!< The original std::string
size_t* pos, //!< Position to start
- char* sym //!< Returned word
+ std::string& sym //!< Returned word
);
/*! \brief Helper function for the std::string processing.
diff --git a/projects/clr/rocclr/runtime/device/gpu/gpuprogram.cpp b/projects/clr/rocclr/runtime/device/gpu/gpuprogram.cpp
index 431cca6e3d..82fae39cf1 100644
--- a/projects/clr/rocclr/runtime/device/gpu/gpuprogram.cpp
+++ b/projects/clr/rocclr/runtime/device/gpu/gpuprogram.cpp
@@ -1085,7 +1085,7 @@ NullProgram::findILFuncs(const std::string& source,
// Loop through all provided program arguments
while (pos != std::string::npos) {
- char funcName[256];
+ std::string funcName;
ILFunc func;
func.code_.begin_ = pos;
@@ -1445,7 +1445,7 @@ NullProgram::parseKernels(const std::string& source)
pos = 0;
// Find all available metadata structures
for (size_t i = 0; i < funcs_.size(); ++i) {
- char funcName[256];
+ std::string funcName;
ILFunc::SourceRange range;
// Find function metadata start