Use globalMemSize from deviceInfo to compare private/scratch size

Signed-off-by: Maciej Plewka <maciej.plewka@intel.com>
This commit is contained in:
Maciej Plewka 2022-11-03 11:30:51 +01:00 committed by Compute-Runtime-Automation
parent 6a6ab80113
commit 9fa6f1075e
3 changed files with 5 additions and 6 deletions

View File

@ -457,7 +457,6 @@ HWTEST_F(ClDrmMemoryManagerTest, givenDrmMemoryManagerWhenTiledImageIsBeingCreat
mock->ioctl_expected.gemClose = 2;
mock->ioctl_expected.gemUserptr = 1;
mock->ioctl_expected.execbuffer2 = 0;
mock->ioctl_expected.contextGetParam = 5;
// builtins kernels
mock->ioctl_expected.gemUserptr += 5;

View File

@ -48,7 +48,7 @@ uint32_t KernelHelper::getMaxWorkGroupCount(uint32_t simd, uint32_t availableThr
}
KernelHelper::ErrorCode KernelHelper::checkIfThereIsSpaceForScratchOrPrivate(KernelDescriptor::KernelAttributes attributes, Device *device) {
auto globalMemorySize = device->getRootDevice()->getGlobalMemorySize(static_cast<uint32_t>(device->getDeviceBitfield().to_ulong()));
auto globalMemorySize = device->getDeviceInfo().globalMemSize;
uint32_t sizes[] = {attributes.perHwThreadPrivateMemorySize,
attributes.perThreadScratchSize[0],
attributes.perThreadScratchSize[1]};

View File

@ -84,28 +84,28 @@ TEST_F(KernelHelperMaxWorkGroupsTests, GivenVariousValuesWhenCalculatingMaxWorkG
using KernelHelperTest = Test<DeviceFixture>;
TEST_F(KernelHelperTest, GivenStatelessPrivateSizeGreaterThanGlobalSizeWhenCheckingIfThereIsEnaughSpaceThenOutOfMemReturned) {
auto globalSize = pDevice->getRootDevice()->getGlobalMemorySize(static_cast<uint32_t>(pDevice->getDeviceBitfield().to_ulong()));
auto globalSize = pDevice->getDeviceInfo().globalMemSize;
KernelDescriptor::KernelAttributes attributes = {};
attributes.perHwThreadPrivateMemorySize = (static_cast<uint32_t>((globalSize + pDevice->getDeviceInfo().computeUnitsUsedForScratch) / pDevice->getDeviceInfo().computeUnitsUsedForScratch)) + 100;
EXPECT_EQ(KernelHelper::checkIfThereIsSpaceForScratchOrPrivate(attributes, pDevice), KernelHelper::ErrorCode::OUT_OF_DEVICE_MEMORY);
}
TEST_F(KernelHelperTest, GivenScratchSizeGreaterThanGlobalSizeWhenCheckingIfThereIsEnaughSpaceThenOutOfMemReturned) {
auto globalSize = pDevice->getRootDevice()->getGlobalMemorySize(static_cast<uint32_t>(pDevice->getDeviceBitfield().to_ulong()));
auto globalSize = pDevice->getDeviceInfo().globalMemSize;
KernelDescriptor::KernelAttributes attributes = {};
attributes.perThreadScratchSize[0] = (static_cast<uint32_t>((globalSize + pDevice->getDeviceInfo().computeUnitsUsedForScratch) / pDevice->getDeviceInfo().computeUnitsUsedForScratch)) + 100;
EXPECT_EQ(KernelHelper::checkIfThereIsSpaceForScratchOrPrivate(attributes, pDevice), KernelHelper::ErrorCode::OUT_OF_DEVICE_MEMORY);
}
TEST_F(KernelHelperTest, GivenScratchPrivateSizeGreaterThanGlobalSizeWhenCheckingIfThereIsEnaughSpaceThenOutOfMemReturned) {
auto globalSize = pDevice->getRootDevice()->getGlobalMemorySize(static_cast<uint32_t>(pDevice->getDeviceBitfield().to_ulong()));
auto globalSize = pDevice->getDeviceInfo().globalMemSize;
KernelDescriptor::KernelAttributes attributes = {};
attributes.perThreadScratchSize[1] = (static_cast<uint32_t>((globalSize + pDevice->getDeviceInfo().computeUnitsUsedForScratch) / pDevice->getDeviceInfo().computeUnitsUsedForScratch)) + 100;
EXPECT_EQ(KernelHelper::checkIfThereIsSpaceForScratchOrPrivate(attributes, pDevice), KernelHelper::ErrorCode::OUT_OF_DEVICE_MEMORY);
}
TEST_F(KernelHelperTest, GivenScratchAndPrivateSizeLessThanGlobalSizeWhenCheckingIfThereIsEnaughSpaceThenSuccessReturned) {
auto globalSize = pDevice->getRootDevice()->getGlobalMemorySize(static_cast<uint32_t>(pDevice->getDeviceBitfield().to_ulong()));
auto globalSize = pDevice->getDeviceInfo().globalMemSize;
KernelDescriptor::KernelAttributes attributes = {};
auto size = (static_cast<uint32_t>((globalSize + pDevice->getDeviceInfo().computeUnitsUsedForScratch) / pDevice->getDeviceInfo().computeUnitsUsedForScratch)) - 100;
attributes.perHwThreadPrivateMemorySize = size;