42f4b2af97
ECR #377625 - AMDIL Function support: Calculate total private memory usage by a kernel including memory used by called functions. This cannot be done by IPA since stack size is known only after register allocation due to potential register spill, but MachineFunctionAnalysis cannot persist after CGSCC pass with current LLVM version. This change adds private memory usage metadata for non-kernel functions. The total private memory usage by a kernel is calculated when AMDIL is split for different kernels. BIF will contain total private memory size. Affected files ... ... //depot/stg/opencl/drivers/opencl/compiler/lib/utils/amdilUtils.cpp#1 add ... //depot/stg/opencl/drivers/opencl/compiler/lib/utils/amdilUtils.hpp#1 add ... //depot/stg/opencl/drivers/opencl/compiler/llvm/lib/Target/AMDIL/AMDILKernelManager.cpp#451 edit ... //depot/stg/opencl/drivers/opencl/compiler/llvm/lib/Target/AMDIL/AMDILKernelManager.h#51 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuprogram.cpp#175 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuprogram.hpp#54 edit
15 lines
529 B
C++
15 lines
529 B
C++
#include "amdilUtils.hpp"
|
|
#include <regex>
|
|
#include <string>
|
|
#include <sstream>
|
|
|
|
// Change all private uav length in a kernel
|
|
void amdilUtils::changePrivateUAVLength(std::string& kernel, unsigned length) {
|
|
std::regex pattern("dcl_typeless_uav_id\\(([[:digit:]]+)\\)_stride"
|
|
"\\(([[:digit:]]+)\\)_length\\([[:digit:]]+\\)_access\\(private\\)");
|
|
std::stringstream ss;
|
|
ss << "dcl_typeless_uav_id($1)_stride($2)_length(" << length <<
|
|
")_access(private)";
|
|
kernel = std::regex_replace(kernel, pattern, ss.str());
|
|
}
|