SWDEV-282397 - Alloc scratch memory on the current queue

Device enqueue has an option to execute scheduler on the current
queue and it's enabled by default. Make sure scratch is allocated
on the current queue for that case. Add max vgpr tracking per
program to adjust scratch size accordingly.

Change-Id: I2a6d796913a4551a1e7f343a2465d589eec60d8a


[ROCm/clr commit: e553b2763a]
이 커밋은 다음에 포함됨:
German Andryeyev가 2021-04-20 12:59:44 -04:00를 커밋했습니다
1 부모 44e600b701
커밋 8cea0215fb
3 파일이 변경됨
+21 -6

검색과 일치하는 파일 없음

+4
파일 보기
@@ -181,6 +181,7 @@ HSAILProgram::HSAILProgram(Device& device, amd::Program& owner)
codeSegGpu_(nullptr),
codeSegment_(nullptr),
maxScratchRegs_(0),
maxVgprs_(0),
executable_(nullptr),
loaderContext_(this) {
assert(device.isOnline());
@@ -194,6 +195,7 @@ HSAILProgram::HSAILProgram(NullDevice& device, amd::Program& owner)
codeSegGpu_(nullptr),
codeSegment_(nullptr),
maxScratchRegs_(0),
maxVgprs_(0),
executable_(nullptr),
loaderContext_(this) {
assert(!device.isOnline());
@@ -317,6 +319,7 @@ bool HSAILProgram::setKernels(amd::option::Options* options, void* binary, size_
// with dynamic parallelism, since runtime doesn't know which child kernel will be called
maxScratchRegs_ =
std::max(static_cast<uint>(aKernel->workGroupInfo()->scratchRegs_), maxScratchRegs_);
maxVgprs_ = std::max(static_cast<uint>(aKernel->workGroupInfo()->usedVGPRs_), maxVgprs_);
}
// Allocate kernel table for device enqueuing
if (!isNull() && dynamicParallelism && !allocKernelTable()) {
@@ -781,6 +784,7 @@ bool LightningProgram::setKernels(amd::option::Options* options, void* binary, s
// with dynamic parallelism, since runtime doesn't know which child kernel will be called
maxScratchRegs_ =
std::max(static_cast<uint>(kernel->workGroupInfo()->scratchRegs_), maxScratchRegs_);
maxVgprs_ = std::max(static_cast<uint>(kernel->workGroupInfo()->usedVGPRs_), maxVgprs_);
}
DestroySegmentCpuAccess();
#endif // defined(USE_COMGR_LIBRARY)