P4 to Git Change 1092096 by yaxunl@yaxunl_stg_win50 on 2014/10/29 22:49:51

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


[ROCm/clr commit: a5d50f6926]
This commit is contained in:
foreman
2014-10-29 22:56:55 -04:00
parent 046f1d13f6
commit 04398ca890
3 changed files with 19 additions and 5 deletions
@@ -748,16 +748,16 @@ OPTION(OT_BOOL, \
false, 0, 0, NULL, \
"HSA: use buffer instructions instead of flat for global memory")
// -scras=int or --sc-si-opt-reg-alloc-strategy (default 0)
// 0 let shader compiler choose reg alloc strategy
// -scras=int or --sc-si-opt-reg-alloc-strategy (default 4)
// 4 let OCL compiler choose SC reg alloc strategy by heuristic
// keep this updated with SCShaderSi.h
OPTION(OT_UINT32, \
OA_RUNTIME|OVIS_SUPPORT|OVA_REQUIRED|OA_SEPARATOR_EQUAL, \
"scras", "sc-si-opt-reg-alloc-strategy", \
SCSIOptRegAllocStrategy, \
0, 0, 3, NULL, \
"Set SI+ shader compiler register allocation strategy 0-default, "
"1-balanced, 2-minimize GPRs, 3-minimize moves (default 0).")
4, 0, 4, NULL, \
"Set SI+ shader compiler register allocation strategy 0-SC default, "
"1-balanced, 2-minimize GPRs, 3-minimize moves, 4-heuristic(default 4).")
// -fuser-no-inline -fno-user-no-inline
OPTION(OT_BOOL, \
@@ -12,3 +12,15 @@ void amdilUtils::changePrivateUAVLength(std::string& kernel, unsigned 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;
}
@@ -7,5 +7,7 @@ namespace amdilUtils {
// Change all private uav length in a kernel
void changePrivateUAVLength(std::string& kernel, unsigned length);
bool isKernelMemoryBound(const std::string& kernel);
}
#endif /* AMDILUTILS_H_ */