diff --git a/projects/clr/rocclr/compiler/lib/utils/OPTIONS.def b/projects/clr/rocclr/compiler/lib/utils/OPTIONS.def index eff4cd7625..1fc6b55947 100644 --- a/projects/clr/rocclr/compiler/lib/utils/OPTIONS.def +++ b/projects/clr/rocclr/compiler/lib/utils/OPTIONS.def @@ -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, \ diff --git a/projects/clr/rocclr/compiler/lib/utils/amdilUtils.cpp b/projects/clr/rocclr/compiler/lib/utils/amdilUtils.cpp index babdd4a5ec..c691bbbb2c 100644 --- a/projects/clr/rocclr/compiler/lib/utils/amdilUtils.cpp +++ b/projects/clr/rocclr/compiler/lib/utils/amdilUtils.cpp @@ -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; +} diff --git a/projects/clr/rocclr/compiler/lib/utils/amdilUtils.hpp b/projects/clr/rocclr/compiler/lib/utils/amdilUtils.hpp index f28bcc3ee7..9b49fa1bd7 100644 --- a/projects/clr/rocclr/compiler/lib/utils/amdilUtils.hpp +++ b/projects/clr/rocclr/compiler/lib/utils/amdilUtils.hpp @@ -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_ */