SWDEV-521011 - Allow max stack size as per ISA. (#73)

This commit is contained in:
Patel, Jaydeepkumar
2025-04-07 21:45:38 -07:00
committed by GitHub
parent e974f7fde1
commit 9e7248aa36
4 changed files with 51 additions and 9 deletions
+14 -1
View File
@@ -739,6 +739,18 @@ bool Device::ValidateHsail() {
return true;
}
size_t GetMaxStackSize(const std::string& procName) {
if (procName.find("gfx9") != std::string::npos || procName.find("gfx8")
!= std::string::npos) {
return kMaxStackSize9X;
} else if (procName.find("gfx11") != std::string::npos || procName.find("gfx10")
!= std::string::npos) {
return kMaxStackSize11X;
} else {
return kMaxStackSize12X;
}
}
bool Device::create(const Isa &isa) {
assert(!vaCacheAccess_ && !vaCacheMap_);
isa_ = &isa;
@@ -755,6 +767,7 @@ bool Device::create(const Isa &isa) {
if (!amd::IS_HIP) {
stack_size_ = 16 * Ki;
}
maxStackSize_ = GetMaxStackSize(isa_->processorName());
return true;
}
@@ -930,7 +943,7 @@ bool Device::disableP2P(amd::Device* ptrDev) {
}
bool Device::UpdateStackSize(uint64_t stackSize) {
if (stackSize > kMaxStackSize) {
if (stackSize > maxStackSize_) {
return false;
}
stack_size_ = amd::alignUp(stackSize, 16);