a5d50f6926
EPR #408439 - Add heuristics for setting SC register allocation strategy. Affected files ... ... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/gpu/amdil_be.cpp#40 edit ... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/gpu/scwrapper/SI/scCompileSI.cpp#47 edit ... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/gpu/scwrapper/SI/scCompileSI.h#18 edit ... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/gpu/scwrapper/SI/scStateSI.cpp#26 edit ... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/gpu/scwrapper/scState.cpp#33 edit ... //depot/stg/opencl/drivers/opencl/compiler/lib/utils/OPTIONS.def#120 edit ... //depot/stg/opencl/drivers/opencl/compiler/lib/utils/amdilUtils.cpp#2 edit ... //depot/stg/opencl/drivers/opencl/compiler/lib/utils/amdilUtils.hpp#2 edit ... //depot/stg/opencl/drivers/opencl/compiler/llvm/include/llvm/InitializePasses.h#73 edit ... //depot/stg/opencl/drivers/opencl/compiler/llvm/include/llvm/Transforms/IPO.h#29 edit ... //depot/stg/opencl/drivers/opencl/compiler/llvm/include/llvm/Transforms/IPO/AMDKernelPerfHint.h#1 add ... //depot/stg/opencl/drivers/opencl/compiler/llvm/lib/Target/AMDIL/AMDILKernelManager.cpp#453 edit ... //depot/stg/opencl/drivers/opencl/compiler/llvm/lib/Transforms/IPO/AMDKernelPerfHint.cpp#1 add ... //depot/stg/opencl/drivers/opencl/compiler/llvm/lib/Transforms/IPO/AMDPassManagerBuilder.cpp#46 edit
27 строки
821 B
C++
27 строки
821 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());
|
|
}
|
|
|
|
bool amdilUtils::isKernelMemoryBound(const std::string& kernel) {
|
|
std::istringstream is(kernel);
|
|
std::regex pattern("\\s*;\\s*membound\\s*:\\s*1\\s*");
|
|
while (is) {
|
|
std::string line;
|
|
is >> line;
|
|
if (std::regex_match(line, pattern))
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|