Return error when Kernel SIMD size is not in expected range

Change-Id: Ic4411535cd97f6e4e2c0252c43ab90c78713c5c5
Signed-off-by: Dunajski, Bartosz <bartosz.dunajski@intel.com>
This commit is contained in:
Dunajski, Bartosz
2020-02-13 11:37:05 +01:00
committed by sys_ocldev
parent 5d12bd8583
commit 9a4d515d3f
3 changed files with 42 additions and 5 deletions

View File

@@ -2732,6 +2732,36 @@ TEST(KernelTest, whenNullAllocationThenAssignNullPointerToCacheFlushVector) {
EXPECT_EQ(nullptr, kernel.mockKernel->kernelArgRequiresCacheFlush[0]);
}
TEST(KernelTest, givenKernelCompiledWithSimdSizeLowerThanExpectedWhenInitializingThenReturnError) {
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(platformDevices[0]));
auto minSimd = HwHelper::get(device->getHardwareInfo().platform.eRenderCoreFamily).getMinimalSIMDSize();
MockKernelWithInternals kernel(*device);
kernel.executionEnvironment.CompiledSIMD32 = 0;
kernel.executionEnvironment.CompiledSIMD16 = 0;
kernel.executionEnvironment.CompiledSIMD8 = 1;
cl_int retVal = kernel.mockKernel->initialize();
if (minSimd > 8) {
EXPECT_EQ(CL_INVALID_KERNEL, retVal);
} else {
EXPECT_EQ(CL_SUCCESS, retVal);
}
}
TEST(KernelTest, givenKernelCompiledWithSimdOneWhenInitializingThenReturnError) {
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(platformDevices[0]));
MockKernelWithInternals kernel(*device);
kernel.executionEnvironment.CompiledSIMD32 = 0;
kernel.executionEnvironment.CompiledSIMD16 = 0;
kernel.executionEnvironment.CompiledSIMD8 = 0;
kernel.executionEnvironment.LargestCompiledSIMDSize = 1;
cl_int retVal = kernel.mockKernel->initialize();
EXPECT_EQ(CL_SUCCESS, retVal);
}
TEST(KernelTest, whenAllocationRequiringCacheFlushThenAssignAllocationPointerToCacheFlushVector) {
MockGraphicsAllocation mockAllocation;
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(platformDevices[0]));