Skip to content

Commit 9fa6f10

Browse files
Use globalMemSize from deviceInfo to compare private/scratch size
Signed-off-by: Maciej Plewka <maciej.plewka@intel.com>
1 parent 6a6ab80 commit 9fa6f10

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

opencl/test/unit_test/os_interface/linux/cl_drm_memory_manager_tests.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,6 @@ HWTEST_F(ClDrmMemoryManagerTest, givenDrmMemoryManagerWhenTiledImageIsBeingCreat
457457
mock->ioctl_expected.gemClose = 2;
458458
mock->ioctl_expected.gemUserptr = 1;
459459
mock->ioctl_expected.execbuffer2 = 0;
460-
mock->ioctl_expected.contextGetParam = 5;
461460

462461
// builtins kernels
463462
mock->ioctl_expected.gemUserptr += 5;

shared/source/helpers/kernel_helpers.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ uint32_t KernelHelper::getMaxWorkGroupCount(uint32_t simd, uint32_t availableThr
4848
}
4949

5050
KernelHelper::ErrorCode KernelHelper::checkIfThereIsSpaceForScratchOrPrivate(KernelDescriptor::KernelAttributes attributes, Device *device) {
51-
auto globalMemorySize = device->getRootDevice()->getGlobalMemorySize(static_cast<uint32_t>(device->getDeviceBitfield().to_ulong()));
51+
auto globalMemorySize = device->getDeviceInfo().globalMemSize;
5252
uint32_t sizes[] = {attributes.perHwThreadPrivateMemorySize,
5353
attributes.perThreadScratchSize[0],
5454
attributes.perThreadScratchSize[1]};

shared/test/unit_test/helpers/kernel_helpers_tests.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,28 +84,28 @@ TEST_F(KernelHelperMaxWorkGroupsTests, GivenVariousValuesWhenCalculatingMaxWorkG
8484
using KernelHelperTest = Test<DeviceFixture>;
8585

8686
TEST_F(KernelHelperTest, GivenStatelessPrivateSizeGreaterThanGlobalSizeWhenCheckingIfThereIsEnaughSpaceThenOutOfMemReturned) {
87-
auto globalSize = pDevice->getRootDevice()->getGlobalMemorySize(static_cast<uint32_t>(pDevice->getDeviceBitfield().to_ulong()));
87+
auto globalSize = pDevice->getDeviceInfo().globalMemSize;
8888
KernelDescriptor::KernelAttributes attributes = {};
8989
attributes.perHwThreadPrivateMemorySize = (static_cast<uint32_t>((globalSize + pDevice->getDeviceInfo().computeUnitsUsedForScratch) / pDevice->getDeviceInfo().computeUnitsUsedForScratch)) + 100;
9090
EXPECT_EQ(KernelHelper::checkIfThereIsSpaceForScratchOrPrivate(attributes, pDevice), KernelHelper::ErrorCode::OUT_OF_DEVICE_MEMORY);
9191
}
9292

9393
TEST_F(KernelHelperTest, GivenScratchSizeGreaterThanGlobalSizeWhenCheckingIfThereIsEnaughSpaceThenOutOfMemReturned) {
94-
auto globalSize = pDevice->getRootDevice()->getGlobalMemorySize(static_cast<uint32_t>(pDevice->getDeviceBitfield().to_ulong()));
94+
auto globalSize = pDevice->getDeviceInfo().globalMemSize;
9595
KernelDescriptor::KernelAttributes attributes = {};
9696
attributes.perThreadScratchSize[0] = (static_cast<uint32_t>((globalSize + pDevice->getDeviceInfo().computeUnitsUsedForScratch) / pDevice->getDeviceInfo().computeUnitsUsedForScratch)) + 100;
9797
EXPECT_EQ(KernelHelper::checkIfThereIsSpaceForScratchOrPrivate(attributes, pDevice), KernelHelper::ErrorCode::OUT_OF_DEVICE_MEMORY);
9898
}
9999

100100
TEST_F(KernelHelperTest, GivenScratchPrivateSizeGreaterThanGlobalSizeWhenCheckingIfThereIsEnaughSpaceThenOutOfMemReturned) {
101-
auto globalSize = pDevice->getRootDevice()->getGlobalMemorySize(static_cast<uint32_t>(pDevice->getDeviceBitfield().to_ulong()));
101+
auto globalSize = pDevice->getDeviceInfo().globalMemSize;
102102
KernelDescriptor::KernelAttributes attributes = {};
103103
attributes.perThreadScratchSize[1] = (static_cast<uint32_t>((globalSize + pDevice->getDeviceInfo().computeUnitsUsedForScratch) / pDevice->getDeviceInfo().computeUnitsUsedForScratch)) + 100;
104104
EXPECT_EQ(KernelHelper::checkIfThereIsSpaceForScratchOrPrivate(attributes, pDevice), KernelHelper::ErrorCode::OUT_OF_DEVICE_MEMORY);
105105
}
106106

107107
TEST_F(KernelHelperTest, GivenScratchAndPrivateSizeLessThanGlobalSizeWhenCheckingIfThereIsEnaughSpaceThenSuccessReturned) {
108-
auto globalSize = pDevice->getRootDevice()->getGlobalMemorySize(static_cast<uint32_t>(pDevice->getDeviceBitfield().to_ulong()));
108+
auto globalSize = pDevice->getDeviceInfo().globalMemSize;
109109
KernelDescriptor::KernelAttributes attributes = {};
110110
auto size = (static_cast<uint32_t>((globalSize + pDevice->getDeviceInfo().computeUnitsUsedForScratch) / pDevice->getDeviceInfo().computeUnitsUsedForScratch)) - 100;
111111
attributes.perHwThreadPrivateMemorySize = size;

0 commit comments

Comments
 (0)