From 7f26d48b88994ee16187eee7c174f3870d1a3884 Mon Sep 17 00:00:00 2001
From: foreman
Date: Tue, 29 Jan 2019 17:33:39 -0500
Subject: [PATCH] P4 to Git Change 1737265 by
skudchad@skudchad_test2_win_opencl on 2019/01/29 16:13:19
SWDEV-145570 - [HIP] - Fix maxThreadsPerStreamProcessor info parameter for HIP-VDI
ReviewBoardURL = http://ocltc.amd.com/reviews/r/16626/diff/
Affected files ...
... //depot/stg/opencl/drivers/opencl/api/hip/hip_device.cpp#17 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/device.hpp#331 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpudevice.cpp#601 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/paldevice.cpp#123 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocdevice.cpp#113 edit
[ROCm/clr commit: 13323b876e65884ebe1b9cdf651569f21c773a27]
---
projects/clr/rocclr/runtime/device/device.hpp | 3 +++
projects/clr/rocclr/runtime/device/gpu/gpudevice.cpp | 1 +
projects/clr/rocclr/runtime/device/pal/paldevice.cpp | 3 ++-
projects/clr/rocclr/runtime/device/rocm/rocdevice.cpp | 8 ++++++++
4 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/projects/clr/rocclr/runtime/device/device.hpp b/projects/clr/rocclr/runtime/device/device.hpp
index 38a90e214b..3dce4ced80 100644
--- a/projects/clr/rocclr/runtime/device/device.hpp
+++ b/projects/clr/rocclr/runtime/device/device.hpp
@@ -500,6 +500,9 @@ struct Info : public amd::EmbeddedObject {
uint32_t pcieDeviceId_;
//! Revision ID
uint32_t pcieRevisionId_;
+
+ //! Max numbers of threads per CU
+ cl_uint maxThreadsPerCU_;
};
//! Device settings
diff --git a/projects/clr/rocclr/runtime/device/gpu/gpudevice.cpp b/projects/clr/rocclr/runtime/device/gpu/gpudevice.cpp
index d54ca0ba46..d9d779ecb0 100644
--- a/projects/clr/rocclr/runtime/device/gpu/gpudevice.cpp
+++ b/projects/clr/rocclr/runtime/device/gpu/gpudevice.cpp
@@ -585,6 +585,7 @@ void NullDevice::fillDeviceInfo(const CALdeviceattribs& calAttr, const gslMemInf
info_.pcieDeviceId_ = calAttr.pcieDeviceID;
info_.pcieRevisionId_ = calAttr.pcieRevisionID;
+ info_.maxThreadsPerCU_ = info_.wavefrontWidth_ * hwInfo()->simdPerCU_ * 10;
}
}
diff --git a/projects/clr/rocclr/runtime/device/pal/paldevice.cpp b/projects/clr/rocclr/runtime/device/pal/paldevice.cpp
index 82e292cc5b..21fc5c91d9 100644
--- a/projects/clr/rocclr/runtime/device/pal/paldevice.cpp
+++ b/projects/clr/rocclr/runtime/device/pal/paldevice.cpp
@@ -356,7 +356,6 @@ void NullDevice::fillDeviceInfo(const Pal::DeviceProperties& palProp,
palProp.gfxipProperties.shaderCore.numAvailableCus / 2 :
palProp.gfxipProperties.shaderCore.numAvailableCus;
-
info_.numberOfShaderEngines = palProp.gfxipProperties.shaderCore.numShaderEngines;
// SI parts are scalar. Also, reads don't need to be 128-bits to get peak rates.
@@ -636,6 +635,8 @@ void NullDevice::fillDeviceInfo(const Pal::DeviceProperties& palProp,
info_.pcieDeviceId_ = palProp.deviceId;
info_.pcieRevisionId_ = palProp.revisionId;
+ info_.maxThreadsPerCU_ = info_.wavefrontWidth_ * hwInfo()->simdPerCU_ *
+ palProp.gfxipProperties.shaderCore.numWavefrontsPerSimd;
}
}
diff --git a/projects/clr/rocclr/runtime/device/rocm/rocdevice.cpp b/projects/clr/rocclr/runtime/device/rocm/rocdevice.cpp
index cd82f40dae..f9cf4de5a0 100644
--- a/projects/clr/rocclr/runtime/device/rocm/rocdevice.cpp
+++ b/projects/clr/rocclr/runtime/device/rocm/rocdevice.cpp
@@ -1226,6 +1226,14 @@ bool Device::populateOCLDeviceConstants() {
hsa_agent_get_info(_bkendDevice, (hsa_agent_info_t)HSA_AMD_AGENT_INFO_MEMORY_WIDTH, &info_.vramBusBitWidth_)) {
return false;
}
+
+ uint32_t max_waves_per_cu;
+ if (HSA_STATUS_SUCCESS !=
+ hsa_agent_get_info(_bkendDevice, (hsa_agent_info_t)HSA_AMD_AGENT_INFO_MAX_WAVES_PER_CU, &max_waves_per_cu)) {
+ return false;
+ }
+
+ info_.maxThreadsPerCU_ = info_.wavefrontWidth_ * max_waves_per_cu;
uint32_t cache_sizes[4];
/* FIXIT [skudchad] - Seems like hardcoded in HSA backend so 0*/
if (HSA_STATUS_SUCCESS !=