Correct CL_DEVICE_MAX_NUM_SUB_GROUPS query

Change-Id: Ia7b9b041774513fdbfa2df9d1ad7c6d9dd60929f
Signed-off-by: Filip Hazubski <filip.hazubski@intel.com>
This commit is contained in:
Filip Hazubski 2020-09-11 10:54:46 +02:00
parent a5c556fe11
commit d40510f398
4 changed files with 22 additions and 8 deletions

View File

@ -128,8 +128,17 @@ void ClDevice::initializeCaps() {
deviceInfo.independentForwardProgress = hwInfo.capabilityTable.supportsIndependentForwardProgress;
deviceInfo.ilsWithVersion[0].name[0] = 0;
deviceInfo.ilsWithVersion[0].version = 0;
deviceInfo.maxNumOfSubGroups = 0;
if (ocl21FeaturesEnabled) {
auto simdSizeUsed = DebugManager.flags.UseMaxSimdSizeToDeduceMaxWorkgroupSize.get()
? CommonConstants::maximalSimdSize
: hwHelper.getMinimalSIMDSize();
// calculate a maximum number of subgroups in a workgroup (for the required SIMD size)
deviceInfo.maxNumOfSubGroups = static_cast<uint32_t>(sharedDeviceInfo.maxWorkGroupSize / simdSizeUsed);
if (deviceInfo.independentForwardProgress) {
deviceExtensions += "cl_khr_subgroups ";
}
@ -288,12 +297,6 @@ void ClDevice::initializeCaps() {
deviceInfo.maxComputUnits = systemInfo.EUCount * getNumAvailableDevices();
deviceInfo.maxConstantArgs = 8;
deviceInfo.maxSliceCount = systemInfo.SliceCount;
auto simdSizeUsed = DebugManager.flags.UseMaxSimdSizeToDeduceMaxWorkgroupSize.get()
? CommonConstants::maximalSimdSize
: hwHelper.getMinimalSIMDSize();
// calculate a maximum number of subgroups in a workgroup (for the required SIMD size)
deviceInfo.maxNumOfSubGroups = static_cast<uint32_t>(sharedDeviceInfo.maxWorkGroupSize / simdSizeUsed);
deviceInfo.singleFpConfig |= defaultFpFlags;

View File

@ -18,6 +18,7 @@
#include "opencl/test/unit_test/mocks/mock_builtins.h"
#include "opencl/test/unit_test/mocks/mock_execution_environment.h"
#include "opencl/test/unit_test/mocks/ult_cl_device_factory.h"
#include "opencl/test/unit_test/test_macros/test_checks_ocl.h"
#include "driver_version.h"
#include "gtest/gtest.h"
@ -211,7 +212,8 @@ TEST_F(DeviceGetCapsTest, WhenCreatingDeviceThenCapsArePopulatedCorrectly) {
EXPECT_EQ(expectedDeviceSubgroups[i], sharedCaps.maxSubGroups[i]);
}
EXPECT_EQ(sharedCaps.maxWorkGroupSize / hwHelper.getMinimalSIMDSize(), caps.maxNumOfSubGroups);
auto expectedMaxNumOfSubGroups = device->areOcl21FeaturesEnabled() ? sharedCaps.maxWorkGroupSize / hwHelper.getMinimalSIMDSize() : 0u;
EXPECT_EQ(expectedMaxNumOfSubGroups, caps.maxNumOfSubGroups);
if (defaultHwInfo->capabilityTable.supportsDeviceEnqueue || (defaultHwInfo->capabilityTable.clVersionSupport == 21)) {
EXPECT_EQ(1024u, caps.maxOnDeviceEvents);
@ -1108,6 +1110,8 @@ HWTEST_F(DeviceGetCapsTest, givenEnabledFtrPooledEuWhenCalculatingMaxEuPerSSThen
}
TEST(DeviceGetCaps, givenDebugFlagToUseMaxSimdSizeForWkgCalculationWhenDeviceCapsAreCreatedThen1024WorkgroupSizeIsReturned) {
REQUIRE_OCL_21_OR_SKIP(defaultHwInfo);
DebugManagerStateRestore dbgRestorer;
DebugManager.flags.UseMaxSimdSizeToDeduceMaxWorkgroupSize.set(true);
@ -1157,6 +1161,8 @@ TEST(DeviceGetCaps, givenDebugFlagToDisableDeviceEnqueuesWhenCreatingDeviceThenD
}
HWTEST_F(DeviceGetCapsTest, givenDeviceThatHasHighNumberOfExecutionUnitsWhenMaxWorkgroupSizeIsComputedItIsLimitedTo1024) {
REQUIRE_OCL_21_OR_SKIP(defaultHwInfo);
HardwareInfo myHwInfo = *defaultHwInfo;
GT_SYSTEM_INFO &mySysInfo = myHwInfo.gtSystemInfo;
auto &hwHelper = HwHelper::get(myHwInfo.platform.eRenderCoreFamily);

View File

@ -27,6 +27,10 @@ bool TestChecks::supportsOcl21(const Context *pContext) {
return pContext->getDevice(0)->areOcl21FeaturesEnabled();
}
bool TestChecks::supportsOcl21(const std::unique_ptr<HardwareInfo> &pHardwareInfo) {
return pHardwareInfo->capabilityTable.supportsOcl21Features;
}
bool TestChecks::supportsDeviceEnqueue(const ClDevice *pClDevice) {
return pClDevice->getHardwareInfo().capabilityTable.supportsDeviceEnqueue;
}

View File

@ -18,6 +18,7 @@ namespace TestChecks {
bool supportsSvm(const ClDevice *pClDevice);
bool supportsImages(const Context *pContext);
bool supportsOcl21(const Context *pContext);
bool supportsOcl21(const std::unique_ptr<HardwareInfo> &pHardwareInfo);
bool supportsDeviceEnqueue(const ClDevice *pClDevice);
bool supportsDeviceEnqueue(const Context *pContext);
bool supportsDeviceEnqueue(const std::unique_ptr<HardwareInfo> &pHardwareInfo);