diff --git a/projects/clr/rocclr/runtime/device/rocm/rocdevice.cpp b/projects/clr/rocclr/runtime/device/rocm/rocdevice.cpp index a11471fb4d..0d5deb8788 100644 --- a/projects/clr/rocclr/runtime/device/rocm/rocdevice.cpp +++ b/projects/clr/rocclr/runtime/device/rocm/rocdevice.cpp @@ -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 devices; diff --git a/projects/clr/rocclr/runtime/device/rocm/rockernel.cpp b/projects/clr/rocclr/runtime/device/rocm/rockernel.cpp index d5fe95568c..a92dbb0807 100644 --- a/projects/clr/rocclr/runtime/device/rocm/rockernel.cpp +++ b/projects/clr/rocclr/runtime/device/rocm/rockernel.cpp @@ -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(kernelCodeHandle_), &kernelHostPtr + ) == HSA_STATUS_SUCCESS) { + auto akc = reinterpret_cast(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;