P4 to Git Change 1360479 by rerrabol@RocmOnLC on 2017/01/10 17:32:55

SWDEV-108854 - Support initialization of SGPR and VGPR usage from kernel header object. Changes to fix issue reported by SWDEV-108854

Affected files ...

... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocdevice.cpp#33 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rockernel.cpp#18 edit
This commit is contained in:
foreman
2017-01-10 17:46:11 -05:00
vanhempi 5a5df706ad
commit a3c0b6525f
2 muutettua tiedostoa jossa 20 lisäystä ja 2 poistoa
@@ -285,6 +285,10 @@ bool NullDevice::init() {
if (!initCompiler(offlineDevice_)){
return false;
}
// Return without initializing offline device list
return true;
#if !defined(WITH_LIGHTNING_COMPILER)
//If there is an HSA enabled device online then skip any offline device
std::vector<Device*> devices;
@@ -865,9 +865,23 @@ bool Kernel::init()
workGroupInfo_.privateMemSize_ = workitemPrivateSegmentByteSize_;
workGroupInfo_.usedLDSSize_ = workgroupGroupSegmentByteSize_;
workGroupInfo_.preferredSizeMultiple_ = wavefront_size;
workGroupInfo_.usedSGPRs_ = 0;
// Query kernel header object to initialize the number of
// SGPR's and VGPR's used by the kernel
const void* kernelHostPtr = nullptr;
if (Device::loaderQueryHostAddress(
reinterpret_cast<const void*>(kernelCodeHandle_), &kernelHostPtr
) == HSA_STATUS_SUCCESS) {
auto akc = reinterpret_cast<const amd_kernel_code_t*>(kernelHostPtr);
workGroupInfo_.usedSGPRs_ = akc->wavefront_sgpr_count;
workGroupInfo_.usedVGPRs_ = akc->workitem_vgpr_count;
}
else {
workGroupInfo_.usedSGPRs_ = 0;
workGroupInfo_.usedVGPRs_ = 0;
}
workGroupInfo_.usedStackSize_ = 0;
workGroupInfo_.usedVGPRs_ = 0;
workGroupInfo_.wavefrontPerSIMD_ =
program_->dev().info().maxWorkItemSizes_[0] / wavefront_size;
workGroupInfo_.wavefrontSize_ = wavefront_size;