Refactor OCL api tests

use testedClDevice instead of devices[testedRootDeviceIndex]
pass only tested device to build program
add member ApiFixture::pDevice

Related-To: NEO-4632
Change-Id: I7d8d1bd6c3336970a1ad0f0e48c254eb6f419200
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2020-04-24 12:58:39 +02:00
committed by sys_ocldev
parent 7ed45adb27
commit fe3d0a567f
38 changed files with 216 additions and 217 deletions

View File

@@ -5,6 +5,7 @@
*
*/
#pragma once
#include "shared/source/execution_environment/execution_environment.h"
namespace NEO {

View File

@@ -47,7 +47,7 @@ TEST_F(clAddCommentToAubTest, givenNullptrCommentWhenAddCommentToAubThenErrorIsR
}
TEST_F(clAddCommentToAubTest, givenAubCenterAndProperCommentButNullptrAubManagerWhenAddCommentToAubThenErrorIsReturned) {
pPlatform->peekExecutionEnvironment()->rootDeviceEnvironments[testedRootDeviceIndex]->aubCenter.reset(new MockAubCenter());
pDevice->getExecutionEnvironment()->rootDeviceEnvironments[testedRootDeviceIndex]->aubCenter.reset(new MockAubCenter());
auto retVal = clAddCommentINTEL(pDevice, "comment");
EXPECT_EQ(CL_INVALID_VALUE, retVal);
@@ -65,7 +65,7 @@ TEST_F(clAddCommentToAubTest, givenProperCommentAubCenterAndAubManagerWhenAddCom
auto mockAubCenter = new MockAubCenter();
auto mockAubManager = new AubManagerCommentMock;
mockAubCenter->aubManager.reset(mockAubManager);
pPlatform->peekExecutionEnvironment()->rootDeviceEnvironments[testedRootDeviceIndex]->aubCenter.reset(mockAubCenter);
pDevice->getExecutionEnvironment()->rootDeviceEnvironments[testedRootDeviceIndex]->aubCenter.reset(mockAubCenter);
EXPECT_FALSE(mockAubManager->addCommentCalled);

View File

@@ -42,7 +42,7 @@ struct ApiFixture : PlatformFixture {
rootDeviceEnvironmentBackup.swap(pPlatform->peekExecutionEnvironment()->rootDeviceEnvironments[0]);
}
auto pDevice = pPlatform->getClDevice(testedRootDeviceIndex);
pDevice = pPlatform->getClDevice(testedRootDeviceIndex);
ASSERT_NE(nullptr, pDevice);
testedClDevice = pDevice;
@@ -80,6 +80,7 @@ struct ApiFixture : PlatformFixture {
constexpr static uint32_t numRootDevices = maxRootDeviceCount;
constexpr static uint32_t testedRootDeviceIndex = rootDeviceIndex;
cl_device_id testedClDevice = nullptr;
ClDevice *pDevice = nullptr;
std::unique_ptr<RootDeviceEnvironment> rootDeviceEnvironmentBackup;
};

View File

@@ -55,8 +55,8 @@ TEST_F(clBuildProgramTests, GivenSourceAsInputWhenCreatingProgramWithSourceThenP
retVal = clBuildProgram(
pProgram,
num_devices,
devices,
1,
&testedClDevice,
nullptr,
nullptr,
nullptr);
@@ -93,8 +93,8 @@ TEST_F(clBuildProgramTests, GivenBinaryAsInputWhenCreatingProgramWithSourceThenP
const unsigned char *binaries[1] = {reinterpret_cast<const unsigned char *>(pBinary.get())};
pProgram = clCreateProgramWithBinary(
pContext,
num_devices,
devices,
1,
&testedClDevice,
&binarySize,
binaries,
&binaryStatus,
@@ -107,8 +107,8 @@ TEST_F(clBuildProgramTests, GivenBinaryAsInputWhenCreatingProgramWithSourceThenP
retVal = clBuildProgram(
pProgram,
num_devices,
devices,
1,
&testedClDevice,
nullptr,
nullptr,
nullptr);
@@ -135,8 +135,8 @@ TEST_F(clBuildProgramTests, GivenProgramCreatedFromBinaryWhenBuildProgramWithOpt
const unsigned char *binaries[1] = {reinterpret_cast<const unsigned char *>(pBinary.get())};
pProgram = clCreateProgramWithBinary(
pContext,
num_devices,
devices,
1,
&testedClDevice,
&binarySize,
binaries,
&binaryStatus,
@@ -154,8 +154,8 @@ TEST_F(clBuildProgramTests, GivenProgramCreatedFromBinaryWhenBuildProgramWithOpt
retVal = clBuildProgram(
pProgram,
num_devices,
devices,
1,
&testedClDevice,
newBuildOption,
nullptr,
nullptr);
@@ -179,8 +179,8 @@ TEST_F(clBuildProgramTests, GivenSpirAsInputWhenCreatingProgramFromBinaryThenPro
const unsigned char *binaries[1] = {llvm};
pProgram = clCreateProgramWithBinary(
pContext,
num_devices,
devices,
1,
&testedClDevice,
&binarySize,
binaries,
&binaryStatus,
@@ -201,8 +201,8 @@ TEST_F(clBuildProgramTests, GivenSpirAsInputWhenCreatingProgramFromBinaryThenPro
setIgcDebugVars(igcDebugVars);
retVal = clBuildProgram(
pProgram,
num_devices,
devices,
1,
&testedClDevice,
"-x spir -spir-std=1.2",
nullptr,
nullptr);

View File

@@ -47,8 +47,8 @@ TEST_F(clCloneKernelTests, GivenValidKernelWhenCloningKernelThenSuccessIsReturne
const unsigned char *binaries[1] = {reinterpret_cast<const unsigned char *>(pBinary.get())};
pProgram = clCreateProgramWithBinary(
pContext,
num_devices,
devices,
1,
&testedClDevice,
&binarySize,
binaries,
&binaryStatus,
@@ -61,8 +61,8 @@ TEST_F(clCloneKernelTests, GivenValidKernelWhenCloningKernelThenSuccessIsReturne
retVal = clBuildProgram(
pProgram,
num_devices,
devices,
1,
&testedClDevice,
nullptr,
nullptr,
nullptr);

View File

@@ -49,8 +49,8 @@ TEST_F(clCompileProgramTests, GivenKernelAsSingleSourceWhenCompilingProgramThenS
retVal = clCompileProgram(
pProgram,
num_devices,
devices,
1,
&testedClDevice,
nullptr,
0,
nullptr,
@@ -115,8 +115,8 @@ TEST_F(clCompileProgramTests, GivenKernelAsSourceWithHeaderWhenCompilingProgramT
retVal = clCompileProgram(
pProgram,
num_devices,
devices,
1,
&testedClDevice,
nullptr,
1,
&pHeader,

View File

@@ -7,10 +7,10 @@
#include "shared/source/device/device.h"
#include "shared/test/unit_test/helpers/debug_manager_state_restore.h"
#include "shared/test/unit_test/mocks/mock_device.h"
#include "opencl/source/context/context.h"
#include "opencl/test/unit_test/libult/ult_command_stream_receiver.h"
#include "opencl/test/unit_test/mocks/mock_cl_device.h"
#include "test.h"
#include "cl_api_tests.h"
@@ -25,7 +25,7 @@ TEST_F(clCreateCommandQueueTest, GivenCorrectParametersWhenCreatingCommandQueueT
cl_command_queue cmdQ = nullptr;
cl_queue_properties properties = 0;
cmdQ = clCreateCommandQueue(pContext, devices[testedRootDeviceIndex], properties, &retVal);
cmdQ = clCreateCommandQueue(pContext, testedClDevice, properties, &retVal);
ASSERT_NE(nullptr, cmdQ);
ASSERT_EQ(CL_SUCCESS, retVal);
@@ -35,7 +35,7 @@ TEST_F(clCreateCommandQueueTest, GivenCorrectParametersWhenCreatingCommandQueueT
}
TEST_F(clCreateCommandQueueTest, GivenNullContextWhenCreatingCommandQueueThenInvalidContextErrorIsReturned) {
clCreateCommandQueue(nullptr, devices[testedRootDeviceIndex], 0, &retVal);
clCreateCommandQueue(nullptr, testedClDevice, 0, &retVal);
EXPECT_EQ(CL_INVALID_CONTEXT, retVal);
}
@@ -45,8 +45,9 @@ TEST_F(clCreateCommandQueueTest, GivenNullDeviceWhenCreatingCommandQueueThenInva
}
TEST_F(clCreateCommandQueueTest, GivenDeviceNotAssociatedWithContextWhenCreatingCommandQueueThenInvalidDeviceErrorIsReturned) {
EXPECT_NE(devices[0], devices[testedRootDeviceIndex]);
clCreateCommandQueue(pContext, devices[0], 0, &retVal);
UltClDeviceFactory deviceFactory{1, 0};
EXPECT_FALSE(pContext->isDeviceAssociated(*deviceFactory.rootDevices[0]));
clCreateCommandQueue(pContext, deviceFactory.rootDevices[0], 0, &retVal);
EXPECT_EQ(CL_INVALID_DEVICE, retVal);
}
@@ -54,7 +55,7 @@ TEST_F(clCreateCommandQueueTest, GivenInvalidPropertiesWhenCreatingCommandQueueT
cl_command_queue cmdQ = nullptr;
cl_queue_properties properties = 0xf0000;
cmdQ = clCreateCommandQueue(pContext, devices[testedRootDeviceIndex], properties, &retVal);
cmdQ = clCreateCommandQueue(pContext, testedClDevice, properties, &retVal);
ASSERT_EQ(nullptr, cmdQ);
ASSERT_EQ(CL_INVALID_VALUE, retVal);
@@ -63,7 +64,7 @@ TEST_F(clCreateCommandQueueTest, GivenInvalidPropertiesWhenCreatingCommandQueueT
TEST_F(clCreateCommandQueueTest, GivenOoqParametersWhenQueueIsCreatedThenQueueIsSucesfullyCreated) {
cl_int retVal = CL_SUCCESS;
cl_queue_properties ooq = CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE;
auto cmdq = clCreateCommandQueue(pContext, devices[testedRootDeviceIndex], ooq, &retVal);
auto cmdq = clCreateCommandQueue(pContext, testedClDevice, ooq, &retVal);
EXPECT_NE(nullptr, cmdq);
EXPECT_EQ(retVal, CL_SUCCESS);
retVal = clReleaseCommandQueue(cmdq);
@@ -72,12 +73,12 @@ TEST_F(clCreateCommandQueueTest, GivenOoqParametersWhenQueueIsCreatedThenQueueIs
HWTEST_F(clCreateCommandQueueTest, GivenOoqParametersWhenQueueIsCreatedThenCommandStreamReceiverSwitchesToBatchingMode) {
cl_int retVal = CL_SUCCESS;
cl_queue_properties ooq = CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE;
auto clDevice = castToObject<ClDevice>(devices[testedRootDeviceIndex]);
auto clDevice = castToObject<ClDevice>(testedClDevice);
auto mockDevice = reinterpret_cast<MockDevice *>(&clDevice->getDevice());
auto &csr = mockDevice->getUltCommandStreamReceiver<FamilyType>();
EXPECT_EQ(DispatchMode::ImmediateDispatch, csr.dispatchMode);
auto cmdq = clCreateCommandQueue(pContext, devices[testedRootDeviceIndex], ooq, &retVal);
auto cmdq = clCreateCommandQueue(pContext, testedClDevice, ooq, &retVal);
EXPECT_EQ(DispatchMode::BatchedDispatch, csr.dispatchMode);
retVal = clReleaseCommandQueue(cmdq);
}
@@ -88,12 +89,12 @@ HWTEST_F(clCreateCommandQueueTest, GivenForcedDispatchModeAndOoqParametersWhenQu
cl_int retVal = CL_SUCCESS;
cl_queue_properties ooq = CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE;
auto clDevice = castToObject<ClDevice>(devices[testedRootDeviceIndex]);
auto clDevice = castToObject<ClDevice>(testedClDevice);
auto mockDevice = reinterpret_cast<MockDevice *>(&clDevice->getDevice());
auto &csr = mockDevice->getUltCommandStreamReceiver<FamilyType>();
EXPECT_EQ(DispatchMode::ImmediateDispatch, csr.dispatchMode);
auto cmdq = clCreateCommandQueue(pContext, devices[testedRootDeviceIndex], ooq, &retVal);
auto cmdq = clCreateCommandQueue(pContext, testedClDevice, ooq, &retVal);
EXPECT_EQ(DispatchMode::ImmediateDispatch, csr.dispatchMode);
retVal = clReleaseCommandQueue(cmdq);
}
@@ -101,12 +102,12 @@ HWTEST_F(clCreateCommandQueueTest, GivenForcedDispatchModeAndOoqParametersWhenQu
HWTEST_F(clCreateCommandQueueTest, GivenOoqParametersWhenQueueIsCreatedThenCommandStreamReceiverSwitchesToNTo1SubmissionModel) {
cl_int retVal = CL_SUCCESS;
cl_queue_properties ooq = CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE;
auto clDevice = castToObject<ClDevice>(devices[testedRootDeviceIndex]);
auto clDevice = castToObject<ClDevice>(testedClDevice);
auto mockDevice = reinterpret_cast<MockDevice *>(&clDevice->getDevice());
auto &csr = mockDevice->getUltCommandStreamReceiver<FamilyType>();
EXPECT_FALSE(csr.isNTo1SubmissionModelEnabled());
auto cmdq = clCreateCommandQueue(pContext, devices[testedRootDeviceIndex], ooq, &retVal);
auto cmdq = clCreateCommandQueue(pContext, testedClDevice, ooq, &retVal);
EXPECT_TRUE(csr.isNTo1SubmissionModelEnabled());
retVal = clReleaseCommandQueue(cmdq);
}

View File

@@ -10,12 +10,12 @@
#include "shared/source/os_interface/os_context.h"
#include "shared/test/unit_test/helpers/debug_manager_state_restore.h"
#include "shared/test/unit_test/helpers/variable_backup.h"
#include "shared/test/unit_test/mocks/mock_device.h"
#include "opencl/source/command_queue/command_queue.h"
#include "opencl/source/device_queue/device_queue.h"
#include "opencl/test/unit_test/fixtures/memory_management_fixture.h"
#include "opencl/test/unit_test/helpers/unit_test_helper.h"
#include "opencl/test/unit_test/mocks/mock_cl_device.h"
#include "opencl/test/unit_test/mocks/mock_context.h"
#include "CL/cl_ext.h"
@@ -80,7 +80,7 @@ TEST_P(clCreateCommandQueueWithPropertiesTests, GivenPropertiesWhenCreatingComma
const auto minimumCreateDeviceQueueFlags = static_cast<cl_command_queue_properties>(CL_QUEUE_ON_DEVICE |
CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE);
const auto deviceQueueShouldBeCreated = (commandQueueProperties & minimumCreateDeviceQueueFlags) == minimumCreateDeviceQueueFlags;
if (deviceQueueShouldBeCreated && !castToObject<ClDevice>(this->devices[testedRootDeviceIndex])->getHardwareInfo().capabilityTable.supportsDeviceEnqueue) {
if (deviceQueueShouldBeCreated && !castToObject<ClDevice>(testedClDevice)->getHardwareInfo().capabilityTable.supportsDeviceEnqueue) {
return;
}
@@ -115,7 +115,7 @@ TEST_P(clCreateCommandQueueWithPropertiesTests, GivenPropertiesWhenCreatingComma
cmdQ = clCreateCommandQueueWithProperties(
pContext,
devices[testedRootDeviceIndex],
testedClDevice,
properties,
&retVal);
if (queueOnDeviceUsed && priorityHintsUsed) {
@@ -208,7 +208,7 @@ TEST_F(clCreateCommandQueueWithPropertiesApi, GivenNullContextWhenCreatingComman
TEST_F(clCreateCommandQueueWithPropertiesApi, GivenOoqPropertiesWhenQueueIsCreatedThenSuccessIsReturned) {
cl_int retVal = CL_SUCCESS;
cl_queue_properties ooq[] = {CL_QUEUE_PROPERTIES, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, 0, 0};
auto cmdq = clCreateCommandQueueWithProperties(pContext, devices[testedRootDeviceIndex], ooq, &retVal);
auto cmdq = clCreateCommandQueueWithProperties(pContext, testedClDevice, ooq, &retVal);
EXPECT_NE(nullptr, cmdq);
EXPECT_EQ(retVal, CL_SUCCESS);
@@ -218,7 +218,7 @@ TEST_F(clCreateCommandQueueWithPropertiesApi, GivenOoqPropertiesWhenQueueIsCreat
TEST_F(clCreateCommandQueueWithPropertiesApi, GivenQueueOnDeviceWithoutOoqPropertiesWhenQueueIsCreatedThenErrorIsReturned) {
cl_queue_properties ondevice[] = {CL_QUEUE_PROPERTIES, CL_QUEUE_ON_DEVICE, 0, 0};
auto cmdqd = clCreateCommandQueueWithProperties(pContext, devices[testedRootDeviceIndex], ondevice, &retVal);
auto cmdqd = clCreateCommandQueueWithProperties(pContext, testedClDevice, ondevice, &retVal);
EXPECT_EQ(nullptr, cmdqd);
EXPECT_EQ(retVal, CL_INVALID_VALUE);
}
@@ -226,7 +226,7 @@ TEST_F(clCreateCommandQueueWithPropertiesApi, GivenQueueOnDeviceWithoutOoqProper
TEST_F(clCreateCommandQueueWithPropertiesApi, GivenNullContextAndOoqPropertiesWhenCreatingCommandQueueWithPropertiesThenInvalidContextErrorIsReturned) {
cl_int retVal = CL_SUCCESS;
cl_queue_properties ooq[] = {CL_QUEUE_PROPERTIES, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE | CL_QUEUE_ON_DEVICE | CL_QUEUE_ON_DEVICE_DEFAULT, 0, 0};
auto cmdq = clCreateCommandQueueWithProperties(nullptr, devices[testedRootDeviceIndex], ooq, &retVal);
auto cmdq = clCreateCommandQueueWithProperties(nullptr, testedClDevice, ooq, &retVal);
EXPECT_EQ(nullptr, cmdq);
EXPECT_EQ(retVal, CL_INVALID_CONTEXT);
}
@@ -241,8 +241,9 @@ TEST_F(clCreateCommandQueueWithPropertiesApi, GivenNullDeviceWhenCreatingCommand
TEST_F(clCreateCommandQueueWithPropertiesApi, GivenDeviceNotAssociatedWithContextWhenCreatingCommandQueueWithPropertiesThenInvalidDeviceErrorIsReturned) {
cl_int retVal = CL_OUT_OF_HOST_MEMORY;
EXPECT_NE(devices[0], devices[testedRootDeviceIndex]);
auto cmdq = clCreateCommandQueueWithProperties(pContext, devices[0], nullptr, &retVal);
UltClDeviceFactory deviceFactory{1, 0};
EXPECT_FALSE(pContext->isDeviceAssociated(*deviceFactory.rootDevices[0]));
auto cmdq = clCreateCommandQueueWithProperties(pContext, deviceFactory.rootDevices[0], nullptr, &retVal);
EXPECT_EQ(nullptr, cmdq);
EXPECT_EQ(retVal, CL_INVALID_DEVICE);
}
@@ -250,7 +251,7 @@ TEST_F(clCreateCommandQueueWithPropertiesApi, GivenDeviceNotAssociatedWithContex
TEST_F(clCreateCommandQueueWithPropertiesApi, GivenSizeWhichExceedsMaxDeviceQueueSizeWhenCreatingCommandQueueWithPropertiesThenInvalidQueuePropertiesErrorIsReturned) {
cl_int retVal = CL_SUCCESS;
cl_queue_properties ooq[] = {CL_QUEUE_PROPERTIES, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE | CL_QUEUE_ON_DEVICE | CL_QUEUE_ON_DEVICE_DEFAULT, CL_QUEUE_SIZE, (cl_uint)0xffffffff, 0, 0};
auto cmdq = clCreateCommandQueueWithProperties(pContext, devices[testedRootDeviceIndex], ooq, &retVal);
auto cmdq = clCreateCommandQueueWithProperties(pContext, testedClDevice, ooq, &retVal);
EXPECT_EQ(nullptr, cmdq);
EXPECT_EQ(retVal, CL_INVALID_QUEUE_PROPERTIES);
}
@@ -258,7 +259,7 @@ TEST_F(clCreateCommandQueueWithPropertiesApi, GivenSizeWhichExceedsMaxDeviceQueu
TEST_F(clCreateCommandQueueWithPropertiesApi, GivenQueueOnDeviceWithoutOutOfOrderExecModePropertyWhenCreatingCommandQueueWithPropertiesThenInvalidValueErrorIsReturned) {
cl_int retVal = CL_SUCCESS;
cl_queue_properties odq[] = {CL_QUEUE_PROPERTIES, CL_QUEUE_ON_DEVICE, 0, 0};
auto cmdq = clCreateCommandQueueWithProperties(pContext, devices[testedRootDeviceIndex], odq, &retVal);
auto cmdq = clCreateCommandQueueWithProperties(pContext, testedClDevice, odq, &retVal);
EXPECT_EQ(nullptr, cmdq);
EXPECT_EQ(retVal, CL_INVALID_VALUE);
}
@@ -266,7 +267,7 @@ TEST_F(clCreateCommandQueueWithPropertiesApi, GivenQueueOnDeviceWithoutOutOfOrde
TEST_F(clCreateCommandQueueWithPropertiesApi, GivenDefaultDeviceQueueWithoutQueueOnDevicePropertyWhenCreatingCommandQueueWithPropertiesThenInvalidValueErrorIsReturned) {
cl_int retVal = CL_SUCCESS;
cl_queue_properties ddq[] = {CL_QUEUE_PROPERTIES, CL_QUEUE_ON_DEVICE_DEFAULT, 0, 0};
auto cmdq = clCreateCommandQueueWithProperties(pContext, devices[testedRootDeviceIndex], ddq, &retVal);
auto cmdq = clCreateCommandQueueWithProperties(pContext, testedClDevice, ddq, &retVal);
EXPECT_EQ(nullptr, cmdq);
EXPECT_EQ(retVal, CL_INVALID_VALUE);
}
@@ -276,14 +277,14 @@ HWCMDTEST_F(IGFX_GEN8_CORE, clCreateCommandQueueWithPropertiesApi, GivenNumberOf
GTEST_SKIP();
}
cl_int retVal = CL_SUCCESS;
auto pDevice = castToObject<ClDevice>(devices[testedRootDeviceIndex]);
auto pDevice = castToObject<ClDevice>(testedClDevice);
cl_queue_properties odq[] = {CL_QUEUE_PROPERTIES, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE | CL_QUEUE_ON_DEVICE, 0, 0};
auto cmdq1 = clCreateCommandQueueWithProperties(pContext, devices[testedRootDeviceIndex], odq, &retVal);
auto cmdq1 = clCreateCommandQueueWithProperties(pContext, testedClDevice, odq, &retVal);
EXPECT_NE(nullptr, cmdq1);
EXPECT_EQ(retVal, CL_SUCCESS);
auto cmdq2 = clCreateCommandQueueWithProperties(pContext, devices[testedRootDeviceIndex], odq, &retVal);
auto cmdq2 = clCreateCommandQueueWithProperties(pContext, testedClDevice, odq, &retVal);
if (pDevice->getSharedDeviceInfo().maxOnDeviceQueues > 1) {
EXPECT_NE(nullptr, cmdq2);
EXPECT_EQ(retVal, CL_SUCCESS);
@@ -306,7 +307,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, clCreateCommandQueueWithPropertiesApi, GivenFailedAl
cl_queue_properties ooq[] = {CL_QUEUE_PROPERTIES, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE | CL_QUEUE_ON_DEVICE | CL_QUEUE_ON_DEVICE_DEFAULT, 0, 0};
auto retVal = CL_INVALID_VALUE;
auto cmdq = clCreateCommandQueueWithProperties(pContext, devices[testedRootDeviceIndex], ooq, &retVal);
auto cmdq = clCreateCommandQueueWithProperties(pContext, testedClDevice, ooq, &retVal);
if (MemoryManagement::nonfailingAllocation == failureIndex) {
EXPECT_EQ(CL_SUCCESS, retVal);
@@ -323,7 +324,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, clCreateCommandQueueWithPropertiesApi, GivenFailedAl
TEST_F(clCreateCommandQueueWithPropertiesApi, GivenHighPriorityWhenCreatingOoqCommandQueueWithPropertiesThenInvalidQueuePropertiesErrorIsReturned) {
cl_int retVal = CL_SUCCESS;
cl_queue_properties ondevice[] = {CL_QUEUE_PROPERTIES, CL_QUEUE_ON_DEVICE | CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, CL_QUEUE_PRIORITY_KHR, CL_QUEUE_PRIORITY_HIGH_KHR, 0, 0};
auto cmdqd = clCreateCommandQueueWithProperties(pContext, devices[testedRootDeviceIndex], ondevice, &retVal);
auto cmdqd = clCreateCommandQueueWithProperties(pContext, testedClDevice, ondevice, &retVal);
EXPECT_EQ(nullptr, cmdqd);
EXPECT_EQ(retVal, CL_INVALID_QUEUE_PROPERTIES);
}
@@ -331,14 +332,14 @@ TEST_F(clCreateCommandQueueWithPropertiesApi, GivenHighPriorityWhenCreatingOoqCo
TEST_F(clCreateCommandQueueWithPropertiesApi, GivenLowPriorityWhenCreatingOoqCommandQueueWithPropertiesThenInvalidQueuePropertiesErrorIsReturned) {
cl_int retVal = CL_SUCCESS;
cl_queue_properties ondevice[] = {CL_QUEUE_PROPERTIES, CL_QUEUE_ON_DEVICE | CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, CL_QUEUE_PRIORITY_KHR, CL_QUEUE_PRIORITY_LOW_KHR, 0, 0};
auto cmdqd = clCreateCommandQueueWithProperties(pContext, devices[testedRootDeviceIndex], ondevice, &retVal);
auto cmdqd = clCreateCommandQueueWithProperties(pContext, testedClDevice, ondevice, &retVal);
EXPECT_EQ(nullptr, cmdqd);
EXPECT_EQ(retVal, CL_INVALID_QUEUE_PROPERTIES);
}
TEST_F(clCreateCommandQueueWithPropertiesApi, GivenMedPriorityWhenCreatingOoqCommandQueueWithPropertiesThenInvalidQueuePropertiesErrorIsReturned) {
cl_int retVal = CL_SUCCESS;
cl_queue_properties ondevice[] = {CL_QUEUE_PROPERTIES, CL_QUEUE_ON_DEVICE | CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, CL_QUEUE_PRIORITY_KHR, CL_QUEUE_PRIORITY_MED_KHR, 0, 0};
auto cmdqd = clCreateCommandQueueWithProperties(pContext, devices[testedRootDeviceIndex], ondevice, &retVal);
auto cmdqd = clCreateCommandQueueWithProperties(pContext, testedClDevice, ondevice, &retVal);
EXPECT_EQ(nullptr, cmdqd);
EXPECT_EQ(retVal, CL_INVALID_QUEUE_PROPERTIES);
}
@@ -346,7 +347,7 @@ TEST_F(clCreateCommandQueueWithPropertiesApi, GivenMedPriorityWhenCreatingOoqCom
TEST_F(clCreateCommandQueueWithPropertiesApi, GivenInvalidPropertiesWhenCreatingOoqCommandQueueWithPropertiesThenInvalidValueErrorIsReturned) {
cl_int retVal = CL_SUCCESS;
cl_queue_properties properties = CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE;
auto commandQueue = clCreateCommandQueueWithProperties(pContext, devices[testedRootDeviceIndex], &properties, &retVal);
auto commandQueue = clCreateCommandQueueWithProperties(pContext, testedClDevice, &properties, &retVal);
EXPECT_EQ(nullptr, commandQueue);
EXPECT_EQ(retVal, CL_INVALID_VALUE);
}
@@ -354,14 +355,14 @@ TEST_F(clCreateCommandQueueWithPropertiesApi, GivenInvalidPropertiesWhenCreating
TEST_F(clCreateCommandQueueWithPropertiesApi, givenInvalidPropertiesOnSubsequentTokenWhenQueueIsCreatedThenReturnError) {
cl_int retVal = CL_SUCCESS;
cl_queue_properties properties[] = {CL_QUEUE_PROPERTIES, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, CL_DEVICE_PARTITION_EQUALLY, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, 0};
auto commandQueue = clCreateCommandQueueWithProperties(pContext, devices[testedRootDeviceIndex], properties, &retVal);
auto commandQueue = clCreateCommandQueueWithProperties(pContext, testedClDevice, properties, &retVal);
EXPECT_EQ(nullptr, commandQueue);
EXPECT_EQ(retVal, CL_INVALID_VALUE);
}
TEST_F(clCreateCommandQueueWithPropertiesApi, GivenNullPropertiesWhenCreatingCommandQueueWithPropertiesThenSuccessIsReturned) {
cl_int retVal = CL_SUCCESS;
auto commandQueue = clCreateCommandQueueWithProperties(pContext, devices[testedRootDeviceIndex], nullptr, &retVal);
auto commandQueue = clCreateCommandQueueWithProperties(pContext, testedClDevice, nullptr, &retVal);
EXPECT_NE(nullptr, commandQueue);
EXPECT_EQ(retVal, CL_SUCCESS);
clReleaseCommandQueue(commandQueue);
@@ -370,7 +371,7 @@ TEST_F(clCreateCommandQueueWithPropertiesApi, GivenNullPropertiesWhenCreatingCom
TEST_F(clCreateCommandQueueWithPropertiesApi, GivenLowPriorityWhenCreatingCommandQueueWithPropertiesThenSuccessIsReturned) {
cl_int retVal = CL_SUCCESS;
cl_queue_properties ondevice[] = {CL_QUEUE_PRIORITY_KHR, CL_QUEUE_PRIORITY_LOW_KHR, 0};
auto cmdqd = clCreateCommandQueueWithProperties(pContext, devices[testedRootDeviceIndex], ondevice, &retVal);
auto cmdqd = clCreateCommandQueueWithProperties(pContext, testedClDevice, ondevice, &retVal);
EXPECT_NE(nullptr, cmdqd);
EXPECT_EQ(retVal, CL_SUCCESS);
retVal = clReleaseCommandQueue(cmdqd);
@@ -379,7 +380,7 @@ TEST_F(clCreateCommandQueueWithPropertiesApi, GivenLowPriorityWhenCreatingComman
HWTEST_F(clCreateCommandQueueWithPropertiesApi, GivenLowPriorityWhenCreatingCommandQueueThenSelectRcsEngine) {
cl_queue_properties properties[] = {CL_QUEUE_PRIORITY_KHR, CL_QUEUE_PRIORITY_LOW_KHR, 0};
auto cmdQ = clCreateCommandQueueWithProperties(pContext, devices[testedRootDeviceIndex], properties, nullptr);
auto cmdQ = clCreateCommandQueueWithProperties(pContext, testedClDevice, properties, nullptr);
auto commandQueueObj = castToObject<CommandQueue>(cmdQ);
auto &osContext = commandQueueObj->getGpgpuCommandStreamReceiver().getOsContext();
@@ -420,7 +421,7 @@ class clCreateCommandQueueWithPropertiesApiPriority : public clCreateCommandQueu
TEST_P(clCreateCommandQueueWithPropertiesApiPriority, GivenValidPriorityWhenCreatingCommandQueueWithPropertiesThenCorrectPriorityIsSetInternally) {
cl_int retVal = CL_SUCCESS;
cl_queue_properties ondevice[] = {CL_QUEUE_PRIORITY_KHR, GetParam().first, 0};
auto cmdqd = clCreateCommandQueueWithProperties(pContext, devices[testedRootDeviceIndex], ondevice, &retVal);
auto cmdqd = clCreateCommandQueueWithProperties(pContext, testedClDevice, ondevice, &retVal);
EXPECT_NE(nullptr, cmdqd);
EXPECT_EQ(retVal, CL_SUCCESS);
@@ -447,7 +448,7 @@ class clCreateCommandQueueWithPropertiesApiThrottle : public clCreateCommandQueu
TEST_P(clCreateCommandQueueWithPropertiesApiThrottle, GivenThrottlePropertiesWhenCreatingCommandQueueWithPropertiesThenCorrectThrottleIsSetInternally) {
cl_int retVal = CL_SUCCESS;
cl_queue_properties ondevice[] = {CL_QUEUE_THROTTLE_KHR, GetParam().first, 0};
auto cmdqd = clCreateCommandQueueWithProperties(pContext, devices[testedRootDeviceIndex], ondevice, &retVal);
auto cmdqd = clCreateCommandQueueWithProperties(pContext, testedClDevice, ondevice, &retVal);
EXPECT_NE(nullptr, cmdqd);
EXPECT_EQ(retVal, CL_SUCCESS);

View File

@@ -60,7 +60,7 @@ TEST_F(clCreateContextTests, returnsFail) {
TEST_F(clCreateContextTests, invalidDevices) {
cl_device_id devList[2];
devList[0] = devices[testedRootDeviceIndex];
devList[0] = testedClDevice;
devList[1] = (cl_device_id)ptrGarbage;
auto context = clCreateContext(nullptr, 2, devList, nullptr, nullptr, &retVal);
@@ -83,10 +83,9 @@ TEST_F(clCreateContextTests, nullUserData) {
}
TEST_F(clCreateContextTests, givenMultipleRootDevicesWhenCreateContextThenOutOrHostMemoryErrorIsReturned) {
auto firstDeviceRootDeviceIndex = castToObject<ClDevice>(devices[testedRootDeviceIndex])->getRootDeviceIndex();
auto secondDeviceRootDeviceIndex = castToObject<ClDevice>(devices[testedRootDeviceIndex + 1])->getRootDeviceIndex();
EXPECT_NE(firstDeviceRootDeviceIndex, secondDeviceRootDeviceIndex);
auto context = clCreateContext(nullptr, 2u, &devices[testedRootDeviceIndex], eventCallBack, nullptr, &retVal);
UltClDeviceFactory deviceFactory{2, 0};
cl_device_id devices[] = {deviceFactory.rootDevices[0], deviceFactory.rootDevices[1]};
auto context = clCreateContext(nullptr, 2u, devices, eventCallBack, nullptr, &retVal);
EXPECT_EQ(nullptr, context);
EXPECT_EQ(CL_OUT_OF_HOST_MEMORY, retVal);
}

View File

@@ -37,8 +37,8 @@ TEST_F(clCreateKernelTests, GivenCorrectKernelInProgramWhenCreatingNewKernelThen
const unsigned char *binaries[1] = {reinterpret_cast<const unsigned char *>(pBinary.get())};
pProgram = clCreateProgramWithBinary(
pContext,
num_devices,
devices,
1,
&testedClDevice,
&binarySize,
binaries,
&binaryStatus,
@@ -51,8 +51,8 @@ TEST_F(clCreateKernelTests, GivenCorrectKernelInProgramWhenCreatingNewKernelThen
retVal = clBuildProgram(
pProgram,
num_devices,
devices,
1,
&testedClDevice,
nullptr,
nullptr,
nullptr);
@@ -92,8 +92,8 @@ TEST_F(clCreateKernelTests, GivenInvalidKernelNameWhenCreatingNewKernelThenInval
const unsigned char *binaries[1] = {reinterpret_cast<const unsigned char *>(pBinary.get())};
pProgram = clCreateProgramWithBinary(
pContext,
num_devices,
devices,
1,
&testedClDevice,
&binarySize,
binaries,
&binaryStatus,
@@ -106,8 +106,8 @@ TEST_F(clCreateKernelTests, GivenInvalidKernelNameWhenCreatingNewKernelThenInval
retVal = clBuildProgram(
pProgram,
num_devices,
devices,
1,
&testedClDevice,
nullptr,
nullptr,
nullptr);
@@ -141,7 +141,7 @@ TEST_F(clCreateKernelTests, GivenNullKernelNameWhenCreatingNewKernelThenInvalidV
cl_kernel kernel = nullptr;
KernelInfo *pKernelInfo = new KernelInfo();
std::unique_ptr<MockProgram> pMockProg = std::make_unique<MockProgram>(*pPlatform->peekExecutionEnvironment(), pContext, false, nullptr);
std::unique_ptr<MockProgram> pMockProg = std::make_unique<MockProgram>(*pDevice->getExecutionEnvironment(), pContext, false, nullptr);
pMockProg->addKernelInfo(pKernelInfo);
kernel = clCreateKernel(
@@ -167,7 +167,7 @@ TEST_F(clCreateKernelTests, GivenInvalidProgramWhenCreatingNewKernelThenInvalidP
TEST_F(clCreateKernelTests, GivenProgramWithBuildErrorWhenCreatingNewKernelThenInvalidProgramExecutableErrorIsReturned) {
cl_kernel kernel = nullptr;
std::unique_ptr<MockProgram> pMockProg = std::make_unique<MockProgram>(*pPlatform->peekExecutionEnvironment(), pContext, false, nullptr);
std::unique_ptr<MockProgram> pMockProg = std::make_unique<MockProgram>(*pDevice->getExecutionEnvironment(), pContext, false, nullptr);
pMockProg->SetBuildStatus(CL_BUILD_ERROR);
kernel = clCreateKernel(

View File

@@ -32,8 +32,8 @@ struct clCreateKernelsInProgramTests : public api_tests {
const unsigned char *binaries[1] = {reinterpret_cast<const unsigned char *>(pBinary.get())};
program = clCreateProgramWithBinary(
pContext,
num_devices,
devices,
1,
&testedClDevice,
&binarySize,
binaries,
&binaryStatus,
@@ -45,8 +45,8 @@ struct clCreateKernelsInProgramTests : public api_tests {
retVal = clBuildProgram(
program,
num_devices,
devices,
1,
&testedClDevice,
nullptr,
nullptr,
nullptr);

View File

@@ -39,8 +39,8 @@ TEST_F(clCreateProgramWithBinaryTests, GivenCorrectParametersWhenCreatingProgram
const unsigned char *binaries[1] = {reinterpret_cast<const unsigned char *>(pBinary.get())};
pProgram = clCreateProgramWithBinary(
pContext,
num_devices,
devices,
1,
&testedClDevice,
&binarySize,
binaries,
&binaryStatus,
@@ -56,8 +56,8 @@ TEST_F(clCreateProgramWithBinaryTests, GivenCorrectParametersWhenCreatingProgram
pProgram = clCreateProgramWithBinary(
nullptr,
num_devices,
devices,
1,
&testedClDevice,
&binarySize,
binaries,
&binaryStatus,

View File

@@ -27,7 +27,7 @@ typedef api_tests clCreateProgramWithBuiltInKernelsTests;
struct clCreateProgramWithBuiltInVmeKernelsTests : clCreateProgramWithBuiltInKernelsTests {
void SetUp() override {
clCreateProgramWithBuiltInKernelsTests::SetUp();
if (!castToObject<ClDevice>(devices[testedRootDeviceIndex])->getHardwareInfo().capabilityTable.supportsVme) {
if (!castToObject<ClDevice>(testedClDevice)->getHardwareInfo().capabilityTable.supportsVme) {
GTEST_SKIP();
}

View File

@@ -35,7 +35,7 @@ TEST_F(clEnqueueSVMMemFillTests, GivenInvalidCommandQueueWhenFillingSVMMemoryThe
}
TEST_F(clEnqueueSVMMemFillTests, GivenNullSVMPtrWhenFillingSVMMemoryThenInvalidValueErrorIsReturned) {
const ClDeviceInfo &devInfo = pPlatform->getClDevice(0)->getDeviceInfo();
const ClDeviceInfo &devInfo = pDevice->getDeviceInfo();
if (devInfo.svmCapabilities != 0) {
auto retVal = clEnqueueSVMMemFill(
pCommandQueue, // cl_command_queue command_queue
@@ -52,7 +52,7 @@ TEST_F(clEnqueueSVMMemFillTests, GivenNullSVMPtrWhenFillingSVMMemoryThenInvalidV
}
TEST_F(clEnqueueSVMMemFillTests, GivenRegionSizeZeroWhenFillingSVMMemoryThenInvalidValueErrorIsReturned) {
const ClDeviceInfo &devInfo = pPlatform->getClDevice(0)->getDeviceInfo();
const ClDeviceInfo &devInfo = pDevice->getDeviceInfo();
if (devInfo.svmCapabilities != 0) {
void *ptrSvm = clSVMAlloc(pContext, CL_MEM_READ_WRITE, 256, 4);
EXPECT_NE(nullptr, ptrSvm);
@@ -104,7 +104,7 @@ TEST_F(clEnqueueSVMMemFillTests, GivenNonNullEventWaitListAndZeroEventsWhenFilli
}
TEST_F(clEnqueueSVMMemFillTests, GivenValidParametersWhenFillingSVMMemoryThenSuccessIsReturned) {
const ClDeviceInfo &devInfo = pPlatform->getClDevice(0)->getDeviceInfo();
const ClDeviceInfo &devInfo = pDevice->getDeviceInfo();
if (devInfo.svmCapabilities != 0) {
void *ptrSvm = clSVMAlloc(pContext, CL_MEM_READ_WRITE, 256, 4);
EXPECT_NE(nullptr, ptrSvm);

View File

@@ -35,7 +35,7 @@ TEST_F(clEnqueueSVMMemcpyTests, GivenInvalidCommandQueueWhenCopyingSVMMemoryThen
}
TEST_F(clEnqueueSVMMemcpyTests, GivenNullDstPtrWhenCopyingSVMMemoryThenInvalidValueErrorIsReturned) {
const ClDeviceInfo &devInfo = pPlatform->getClDevice(0)->getDeviceInfo();
const ClDeviceInfo &devInfo = pDevice->getDeviceInfo();
if (devInfo.svmCapabilities != 0) {
void *pSrcSvm = clSVMAlloc(pContext, CL_MEM_READ_WRITE, 256, 4);
EXPECT_NE(nullptr, pSrcSvm);
@@ -57,7 +57,7 @@ TEST_F(clEnqueueSVMMemcpyTests, GivenNullDstPtrWhenCopyingSVMMemoryThenInvalidVa
}
TEST_F(clEnqueueSVMMemcpyTests, GivenNullSrcPtrWhenCopyingSVMMemoryThenInvalidValueErrorIsReturned) {
const ClDeviceInfo &devInfo = pPlatform->getClDevice(0)->getDeviceInfo();
const ClDeviceInfo &devInfo = pDevice->getDeviceInfo();
if (devInfo.svmCapabilities != 0) {
void *pDstSvm = clSVMAlloc(pContext, CL_MEM_READ_WRITE, 256, 4);
EXPECT_NE(nullptr, pDstSvm);
@@ -109,7 +109,7 @@ TEST_F(clEnqueueSVMMemcpyTests, GivenZeroEventsAndNonNullEventListWhenCopyingSVM
}
TEST_F(clEnqueueSVMMemcpyTests, GivenNonZeroSizeWhenCopyingSVMMemoryThenSuccessIsReturned) {
const ClDeviceInfo &devInfo = pPlatform->getClDevice(0)->getDeviceInfo();
const ClDeviceInfo &devInfo = pDevice->getDeviceInfo();
if (devInfo.svmCapabilities != 0) {
void *pDstSvm = clSVMAlloc(pContext, CL_MEM_READ_WRITE, 256, 4);
EXPECT_NE(nullptr, pDstSvm);
@@ -134,7 +134,7 @@ TEST_F(clEnqueueSVMMemcpyTests, GivenNonZeroSizeWhenCopyingSVMMemoryThenSuccessI
}
TEST_F(clEnqueueSVMMemcpyTests, GivenZeroSizeWhenCopyingSVMMemoryThenSuccessIsReturned) {
const ClDeviceInfo &devInfo = pPlatform->getClDevice(0)->getDeviceInfo();
const ClDeviceInfo &devInfo = pDevice->getDeviceInfo();
if (devInfo.svmCapabilities != 0) {
void *pDstSvm = clSVMAlloc(pContext, CL_MEM_READ_WRITE, 256, 4);
EXPECT_NE(nullptr, pDstSvm);

View File

@@ -40,7 +40,7 @@ TEST_F(clEnqueueSVMMigrateMemTests, GivenInvalidCommandQueueWhenMigratingSVMThen
}
TEST_F(clEnqueueSVMMigrateMemTests, GivenNullSvmPointersWhenMigratingSvmThenInvalidValueErrorIsReturned) {
const ClDeviceInfo &devInfo = pPlatform->getClDevice(0)->getDeviceInfo();
const ClDeviceInfo &devInfo = pDevice->getDeviceInfo();
if (devInfo.svmCapabilities != 0) {
auto retVal = clEnqueueSVMMigrateMem(
pCommandQueue, // cl_command_queue command_queue
@@ -57,7 +57,7 @@ TEST_F(clEnqueueSVMMigrateMemTests, GivenNullSvmPointersWhenMigratingSvmThenInva
}
TEST_F(clEnqueueSVMMigrateMemTests, GivenNumSvmPointersIsZeroWhenMigratingSvmThenInvalidValueErrorIsReturned) {
const ClDeviceInfo &devInfo = pPlatform->getClDevice(0)->getDeviceInfo();
const ClDeviceInfo &devInfo = pDevice->getDeviceInfo();
if (devInfo.svmCapabilities != 0) {
void *ptrSvm = clSVMAlloc(pContext, CL_MEM_READ_WRITE, 256, 4);
ASSERT_NE(nullptr, ptrSvm);
@@ -80,7 +80,7 @@ TEST_F(clEnqueueSVMMigrateMemTests, GivenNumSvmPointersIsZeroWhenMigratingSvmThe
}
TEST_F(clEnqueueSVMMigrateMemTests, GivenSvmPointerIsHostPtrWhenMigratingSvmThenInvalidValueErrorIsReturned) {
const ClDeviceInfo &devInfo = pPlatform->getClDevice(0)->getDeviceInfo();
const ClDeviceInfo &devInfo = pDevice->getDeviceInfo();
if (devInfo.svmCapabilities == 0) {
GTEST_SKIP();
}
@@ -104,7 +104,7 @@ TEST_F(clEnqueueSVMMigrateMemTests, GivenSvmPointerIsHostPtrWhenMigratingSvmThen
}
TEST_F(clEnqueueSVMMigrateMemTests, GivenNonZeroSizeIsNotContainedWithinAllocationWhenMigratingSvmThenInvalidValueErrorIsReturned) {
const ClDeviceInfo &devInfo = pPlatform->getClDevice(0)->getDeviceInfo();
const ClDeviceInfo &devInfo = pDevice->getDeviceInfo();
if (devInfo.svmCapabilities != 0) {
void *ptrSvm = clSVMAlloc(pContext, CL_MEM_READ_WRITE, 256, 4);
ASSERT_NE(nullptr, ptrSvm);
@@ -134,7 +134,7 @@ TEST_F(clEnqueueSVMMigrateMemTests, GivenNonZeroSizeIsNotContainedWithinAllocati
}
TEST_F(clEnqueueSVMMigrateMemTests, GivenUnsupportedFlagsWhenMigratingSvmThenInvalidValueErrorIsReturned) {
const ClDeviceInfo &devInfo = pPlatform->getClDevice(0)->getDeviceInfo();
const ClDeviceInfo &devInfo = pDevice->getDeviceInfo();
if (devInfo.svmCapabilities != 0) {
void *ptrSvm = clSVMAlloc(pContext, CL_MEM_READ_WRITE, 256, 4);
ASSERT_NE(nullptr, ptrSvm);
@@ -187,7 +187,7 @@ TEST_F(clEnqueueSVMMigrateMemTests, GivenNonNullEventWaitListAndZeroNumEventsWhe
}
TEST_F(clEnqueueSVMMigrateMemTests, GivenDifferentContextCommandQueueAndEventsWhenMigratingSvmThenInvalidContextErrorIsReturned) {
const ClDeviceInfo &devInfo = pPlatform->getClDevice(0)->getDeviceInfo();
const ClDeviceInfo &devInfo = pDevice->getDeviceInfo();
if (devInfo.svmCapabilities != 0) {
void *ptrSvm = clSVMAlloc(pContext, CL_MEM_READ_WRITE, 256, 4);
ASSERT_NE(nullptr, ptrSvm);
@@ -213,7 +213,7 @@ TEST_F(clEnqueueSVMMigrateMemTests, GivenDifferentContextCommandQueueAndEventsWh
}
TEST_F(clEnqueueSVMMigrateMemTests, GivenNullSizesWhenMigratingSvmThenSuccessIsReturned) {
const ClDeviceInfo &devInfo = pPlatform->getClDevice(0)->getDeviceInfo();
const ClDeviceInfo &devInfo = pDevice->getDeviceInfo();
if (devInfo.svmCapabilities != 0) {
void *ptrSvm = clSVMAlloc(pContext, CL_MEM_READ_WRITE, 256, 4);
ASSERT_NE(nullptr, ptrSvm);
@@ -236,7 +236,7 @@ TEST_F(clEnqueueSVMMigrateMemTests, GivenNullSizesWhenMigratingSvmThenSuccessIsR
}
TEST_F(clEnqueueSVMMigrateMemTests, GivenSizeZeroWhenMigratingSvmThenSuccessIsReturned) {
const ClDeviceInfo &devInfo = pPlatform->getClDevice(0)->getDeviceInfo();
const ClDeviceInfo &devInfo = pDevice->getDeviceInfo();
if (devInfo.svmCapabilities != 0) {
void *ptrSvm = clSVMAlloc(pContext, CL_MEM_READ_WRITE, 256, 4);
ASSERT_NE(nullptr, ptrSvm);
@@ -260,7 +260,7 @@ TEST_F(clEnqueueSVMMigrateMemTests, GivenSizeZeroWhenMigratingSvmThenSuccessIsRe
}
TEST_F(clEnqueueSVMMigrateMemTests, GivenNonZeroSizeWhenMigratingSvmThenSuccessIsReturned) {
const ClDeviceInfo &devInfo = pPlatform->getClDevice(0)->getDeviceInfo();
const ClDeviceInfo &devInfo = pDevice->getDeviceInfo();
if (devInfo.svmCapabilities != 0) {
void *ptrSvm = clSVMAlloc(pContext, CL_MEM_READ_WRITE, 256, 4);
ASSERT_NE(nullptr, ptrSvm);
@@ -284,7 +284,7 @@ TEST_F(clEnqueueSVMMigrateMemTests, GivenNonZeroSizeWhenMigratingSvmThenSuccessI
}
TEST_F(clEnqueueSVMMigrateMemTests, GivenSameContextCommandQueueAndEventsWhenMigratingSvmThenSuccessIsReturned) {
const ClDeviceInfo &devInfo = pPlatform->getClDevice(0)->getDeviceInfo();
const ClDeviceInfo &devInfo = pDevice->getDeviceInfo();
if (devInfo.svmCapabilities != 0) {
void *ptrSvm = clSVMAlloc(pContext, CL_MEM_READ_WRITE, 256, 4);
ASSERT_NE(nullptr, ptrSvm);

View File

@@ -67,7 +67,7 @@ TEST_F(clEnqueueSVMUnmapTests, GivenNonNullEventListAndZeroEventsWhenUnmappingSv
}
TEST_F(clEnqueueSVMUnmapTests, GivenValidParametersWhenUnmappingSvmThenSuccessIsReturned) {
const ClDeviceInfo &devInfo = pPlatform->getClDevice(0)->getDeviceInfo();
const ClDeviceInfo &devInfo = pDevice->getDeviceInfo();
if (devInfo.svmCapabilities != 0) {
void *ptrSvm = clSVMAlloc(pContext, CL_MEM_READ_WRITE, 256, 4);
EXPECT_NE(nullptr, ptrSvm);

View File

@@ -43,7 +43,7 @@ TEST_F(clGetDeviceAndHostTimerTest, GivenNullHostTimerWhenGettingDeviceAndHostTi
cl_ulong device_timestamp = 0;
retVal = clGetDeviceAndHostTimer(
devices[testedRootDeviceIndex],
testedClDevice,
&device_timestamp,
nullptr);
@@ -54,7 +54,7 @@ TEST_F(clGetDeviceAndHostTimerTest, GivenNullDevicesTimerWhenGettingDeviceAndHos
cl_ulong host_timestamp = 0;
retVal = clGetDeviceAndHostTimer(
devices[testedRootDeviceIndex],
testedClDevice,
nullptr,
&host_timestamp);
@@ -113,7 +113,7 @@ TEST_F(clGetHostTimerTest, GivenNullDeviceWhenGettingHostTimerThenInvalidDeviceE
TEST_F(clGetHostTimerTest, GivenNullHostTimerWhenGettingHostTimerThenInvalidValueErrorIsReturned) {
retVal = clGetHostTimer(
devices[testedRootDeviceIndex],
testedClDevice,
nullptr);
EXPECT_EQ(CL_INVALID_VALUE, retVal);
@@ -124,7 +124,7 @@ TEST_F(clGetHostTimerTest, GivenCorrectParametersWhenGettingHostTimerThenSuccess
cl_ulong zero_timestamp = 0;
retVal = clGetHostTimer(
devices[testedRootDeviceIndex],
testedClDevice,
&host_timestamp);
EXPECT_GE(host_timestamp, zero_timestamp);

View File

@@ -28,7 +28,7 @@ TEST_F(clGetDeviceInfoTests, givenNeoDeviceWhenAskedForSliceCountThenNumberOfSli
paramName = CL_DEVICE_SLICE_COUNT_INTEL;
retVal = clGetDeviceInfo(
devices[testedRootDeviceIndex],
testedClDevice,
paramName,
0,
nullptr,
@@ -39,7 +39,7 @@ TEST_F(clGetDeviceInfoTests, givenNeoDeviceWhenAskedForSliceCountThenNumberOfSli
paramValue = &numSlices;
retVal = clGetDeviceInfo(
devices[testedRootDeviceIndex],
testedClDevice,
paramName,
paramSize,
paramValue,
@@ -60,7 +60,7 @@ TEST_F(clGetDeviceInfoTests, GivenGpuDeviceWhenGettingDeviceInfoThenDeviceTypeGp
paramValue = &deviceType;
retVal = clGetDeviceInfo(
devices[testedRootDeviceIndex],
testedClDevice,
paramName,
paramSize,
paramValue,
@@ -88,7 +88,7 @@ TEST_F(clGetDeviceInfoTests, givenOpenCLDeviceWhenAskedForSupportedSvmTypeCorrec
cl_device_svm_capabilities svmCaps;
retVal = clGetDeviceInfo(
devices[testedRootDeviceIndex],
testedClDevice,
CL_DEVICE_SVM_CAPABILITIES,
sizeof(cl_device_svm_capabilities),
&svmCaps,
@@ -168,7 +168,7 @@ TEST_F(clGetDeviceInfoTests, givenNeoDeviceWhenAskedForDriverVersionThenNeoIsRet
paramName = CL_DEVICE_DRIVER_VERSION_INTEL;
retVal = clGetDeviceInfo(
devices[testedRootDeviceIndex],
testedClDevice,
paramName,
0,
nullptr,
@@ -179,7 +179,7 @@ TEST_F(clGetDeviceInfoTests, givenNeoDeviceWhenAskedForDriverVersionThenNeoIsRet
paramValue = &driverVersion;
retVal = clGetDeviceInfo(
devices[testedRootDeviceIndex],
testedClDevice,
paramName,
paramSize,
paramValue,
@@ -192,7 +192,7 @@ TEST_F(clGetDeviceInfoTests, GivenClDeviceExtensionsParamWhenGettingDeviceInfoTh
size_t paramRetSize = 0;
cl_int retVal = clGetDeviceInfo(
devices[testedRootDeviceIndex],
testedClDevice,
CL_DEVICE_EXTENSIONS,
0,
nullptr,
@@ -203,7 +203,7 @@ TEST_F(clGetDeviceInfoTests, GivenClDeviceExtensionsParamWhenGettingDeviceInfoTh
auto paramValue = std::make_unique<char[]>(paramRetSize);
retVal = clGetDeviceInfo(
devices[testedRootDeviceIndex],
testedClDevice,
CL_DEVICE_EXTENSIONS,
paramRetSize,
paramValue.get(),
@@ -241,13 +241,13 @@ TEST_F(clGetDeviceInfoTests, GivenClDeviceExtensionsParamWhenGettingDeviceInfoTh
TEST_F(clGetDeviceInfoTests, GivenClDeviceIlVersionParamAndOcl21WhenGettingDeviceInfoThenSpirv12IsReturned) {
size_t paramRetSize = 0;
ClDevice *pDevice = castToObject<ClDevice>(devices[testedRootDeviceIndex]);
ClDevice *pDevice = castToObject<ClDevice>(testedClDevice);
if (pDevice->getSupportedClVersion() < 21)
return;
cl_int retVal = clGetDeviceInfo(
devices[testedRootDeviceIndex],
testedClDevice,
CL_DEVICE_IL_VERSION,
0,
nullptr,
@@ -258,7 +258,7 @@ TEST_F(clGetDeviceInfoTests, GivenClDeviceIlVersionParamAndOcl21WhenGettingDevic
auto paramValue = std::make_unique<char[]>(paramRetSize);
retVal = clGetDeviceInfo(
devices[testedRootDeviceIndex],
testedClDevice,
CL_DEVICE_IL_VERSION,
paramRetSize,
paramValue.get(),
@@ -289,7 +289,7 @@ TEST_P(GetDeviceInfoStr, GivenStringTypeParamWhenGettingDeviceInfoThenSuccessIsR
size_t paramRetSize = 0;
cl_int retVal = clGetDeviceInfo(
devices[testedRootDeviceIndex],
testedClDevice,
param,
0,
nullptr,
@@ -300,7 +300,7 @@ TEST_P(GetDeviceInfoStr, GivenStringTypeParamWhenGettingDeviceInfoThenSuccessIsR
auto paramValue = std::make_unique<char[]>(paramRetSize);
retVal = clGetDeviceInfo(
devices[testedRootDeviceIndex],
testedClDevice,
param,
paramRetSize,
paramValue.get(),
@@ -331,7 +331,7 @@ TEST_P(GetDeviceInfoVectorWidth, GivenParamTypeVectorWhenGettingDeviceInfoThenSi
size_t paramRetSize = 0;
auto retVal = clGetDeviceInfo(
devices[testedRootDeviceIndex],
testedClDevice,
param,
0,
nullptr,
@@ -340,7 +340,7 @@ TEST_P(GetDeviceInfoVectorWidth, GivenParamTypeVectorWhenGettingDeviceInfoThenSi
EXPECT_EQ(sizeof(cl_uint), paramRetSize);
retVal = clGetDeviceInfo(
devices[testedRootDeviceIndex],
testedClDevice,
param,
paramRetSize,
&paramValue,

View File

@@ -52,8 +52,8 @@ TEST_F(clGetKernelArgInfoTests, GivenValidParamsWhenGettingKernelArgInfoThenSucc
retVal = clBuildProgram(
pProgram,
num_devices,
devices,
1,
&testedClDevice,
CompilerOptions::argInfo,
nullptr,
nullptr);

View File

@@ -51,8 +51,8 @@ TEST_F(clGetKernelInfoTests, GivenValidParamsWhenGettingKernelInfoThenSuccessIsR
retVal = clBuildProgram(
pProgram,
num_devices,
devices,
1,
&testedClDevice,
nullptr,
nullptr,
nullptr);

View File

@@ -53,8 +53,8 @@ struct clGetKernelWorkGroupInfoTests : public ApiFixture<>,
retVal = clBuildProgram(
pProgram,
num_devices,
devices,
1,
&testedClDevice,
nullptr,
nullptr,
nullptr);
@@ -87,7 +87,7 @@ TEST_P(clGetKernelWorkGroupInfoTests, GivenValidParametersWhenGettingKernelWorkG
size_t paramValueSizeRet;
retVal = clGetKernelWorkGroupInfo(
kernel,
devices[testedRootDeviceIndex],
testedClDevice,
GetParam(),
0,
nullptr,
@@ -100,7 +100,7 @@ TEST_P(clGetKernelWorkGroupInfoTests, GivenValidParametersWhenGettingKernelWorkG
TEST_F(clGetKernelWorkGroupInfoTests, GivenKernelRequiringScratchSpaceWhenGettingKernelWorkGroupInfoThenCorrectSpillMemSizeIsReturned) {
size_t paramValueSizeRet;
cl_ulong param_value;
auto pDevice = castToObject<ClDevice>(devices[testedRootDeviceIndex]);
auto pDevice = castToObject<ClDevice>(testedClDevice);
MockKernelWithInternals mockKernel(*pDevice);
SPatchMediaVFEState mediaVFEstate;
@@ -126,7 +126,7 @@ TEST_F(clGetKernelWorkGroupInfoTests, GivenKernelRequiringScratchSpaceWhenGettin
TEST_F(clGetKernelWorkGroupInfoTests, givenKernelHavingPrivateMemoryAllocationWhenAskedForPrivateAllocationSizeThenProperSizeIsReturned) {
size_t paramValueSizeRet;
cl_ulong param_value;
auto pDevice = castToObject<ClDevice>(devices[testedRootDeviceIndex]);
auto pDevice = castToObject<ClDevice>(testedClDevice);
MockKernelWithInternals mockKernel(*pDevice);
SPatchAllocateStatelessPrivateSurface privateAllocation;
@@ -149,7 +149,7 @@ TEST_F(clGetKernelWorkGroupInfoTests, givenKernelHavingPrivateMemoryAllocationWh
TEST_F(clGetKernelWorkGroupInfoTests, givenKernelNotHavingPrivateMemoryAllocationWhenAskedForPrivateAllocationSizeThenZeroIsReturned) {
size_t paramValueSizeRet;
cl_ulong param_value;
auto pDevice = castToObject<ClDevice>(devices[testedRootDeviceIndex]);
auto pDevice = castToObject<ClDevice>(testedClDevice);
MockKernelWithInternals mockKernel(*pDevice);

View File

@@ -47,7 +47,7 @@ TEST_F(clGetMemObjectInfoTests, GivenBufferWithMappedRegionWhenGettingMemObjectI
cl_mem buffer = nullptr;
cl_queue_properties properties = 0;
cl_command_queue cmdQ = clCreateCommandQueue(pContext, devices[testedRootDeviceIndex], properties, &retVal);
cl_command_queue cmdQ = clCreateCommandQueue(pContext, testedClDevice, properties, &retVal);
buffer = clCreateBuffer(
pContext,
@@ -82,7 +82,7 @@ TEST_F(clGetMemObjectInfoTests, GivenBufferWithMappedRegionWhenGettingMemObjectI
}
TEST_F(clGetMemObjectInfoTests, GivenBufferCreatedFromSvmPointerWhenGettingMemObjectInfoThenClTrueIsReturned) {
const ClDeviceInfo &devInfo = pPlatform->getClDevice(0)->getDeviceInfo();
const ClDeviceInfo &devInfo = pDevice->getDeviceInfo();
if (devInfo.svmCapabilities != 0) {
size_t bufferSize = 64;
cl_mem buffer = nullptr;

View File

@@ -55,14 +55,14 @@ TEST_F(clGetProgramBuildInfoTests, givenSourceWhenclGetProgramBuildInfoIsCalledT
ASSERT_EQ(CL_SUCCESS, retVal);
cl_build_status buildStatus;
retVal = clGetProgramBuildInfo(pProgram, devices[testedRootDeviceIndex], CL_PROGRAM_BUILD_STATUS, sizeof(buildStatus), &buildStatus, NULL);
retVal = clGetProgramBuildInfo(pProgram, testedClDevice, CL_PROGRAM_BUILD_STATUS, sizeof(buildStatus), &buildStatus, NULL);
EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_EQ(CL_BUILD_NONE, buildStatus);
retVal = clCompileProgram(
pProgram,
num_devices,
devices,
1,
&testedClDevice,
nullptr,
0,
nullptr,
@@ -72,26 +72,26 @@ TEST_F(clGetProgramBuildInfoTests, givenSourceWhenclGetProgramBuildInfoIsCalledT
ASSERT_EQ(CL_SUCCESS, retVal);
retVal = clGetProgramBuildInfo(pProgram, devices[testedRootDeviceIndex], CL_PROGRAM_BUILD_STATUS, sizeof(buildStatus), &buildStatus, NULL);
retVal = clGetProgramBuildInfo(pProgram, testedClDevice, CL_PROGRAM_BUILD_STATUS, sizeof(buildStatus), &buildStatus, NULL);
EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_EQ(CL_BUILD_SUCCESS, buildStatus);
retVal = clBuildProgram(
pProgram,
num_devices,
devices,
1,
&testedClDevice,
nullptr,
nullptr,
nullptr);
ASSERT_EQ(CL_SUCCESS, retVal);
retVal = clGetProgramBuildInfo(pProgram, devices[testedRootDeviceIndex], CL_PROGRAM_BUILD_STATUS, sizeof(buildStatus), &buildStatus, NULL);
retVal = clGetProgramBuildInfo(pProgram, testedClDevice, CL_PROGRAM_BUILD_STATUS, sizeof(buildStatus), &buildStatus, NULL);
EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_EQ(CL_BUILD_SUCCESS, buildStatus);
// try to get program build info for invalid program object - should fail
retVal = clGetProgramBuildInfo(nullptr, devices[testedRootDeviceIndex], CL_PROGRAM_BUILD_STATUS, 0, nullptr, nullptr);
retVal = clGetProgramBuildInfo(nullptr, testedClDevice, CL_PROGRAM_BUILD_STATUS, 0, nullptr, nullptr);
EXPECT_EQ(CL_INVALID_PROGRAM, retVal);
retVal = clReleaseProgram(pProgram);
@@ -113,8 +113,8 @@ TEST_F(clGetProgramBuildInfoTests, givenElfBinaryWhenclGetProgramBuildInfoIsCall
const unsigned char *elfBinaryTemp = reinterpret_cast<unsigned char *>(elfBinary.data());
pProgram = clCreateProgramWithBinary(
pContext,
num_devices,
devices,
1,
&testedClDevice,
&binarySize,
&elfBinaryTemp,
&binaryStatus,
@@ -125,7 +125,7 @@ TEST_F(clGetProgramBuildInfoTests, givenElfBinaryWhenclGetProgramBuildInfoIsCall
EXPECT_EQ(CL_SUCCESS, binaryStatus);
cl_build_status buildStatus;
retVal = clGetProgramBuildInfo(pProgram, devices[testedRootDeviceIndex], CL_PROGRAM_BUILD_STATUS, sizeof(buildStatus), &buildStatus, nullptr);
retVal = clGetProgramBuildInfo(pProgram, testedClDevice, CL_PROGRAM_BUILD_STATUS, sizeof(buildStatus), &buildStatus, nullptr);
EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_EQ(CL_BUILD_NONE, buildStatus);

View File

@@ -52,8 +52,8 @@ TEST_F(clGetProgramInfoTests, SuccessfulProgramWithSource) {
retVal = clBuildProgram(
pProgram,
num_devices,
devices,
1,
&testedClDevice,
nullptr,
nullptr,
nullptr);
@@ -68,7 +68,7 @@ TEST_F(clGetProgramInfoTests, SuccessfulProgramWithSource) {
cl_device_id programDevices;
retVal = clGetProgramInfo(pProgram, CL_PROGRAM_DEVICES, sizeof(programDevices), &programDevices, nullptr);
EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_EQ(devices[testedRootDeviceIndex], programDevices);
EXPECT_EQ(testedClDevice, programDevices);
size_t length = 0;
char buffer[10240];

View File

@@ -46,13 +46,13 @@ TEST_F(IntelTracingTest, GivenInvalidDeviceExpectFail) {
}
TEST_F(IntelTracingTest, GivenInvalidCallbackExpectFail) {
status = clCreateTracingHandleINTEL(devices[testedRootDeviceIndex], nullptr, nullptr, &handle);
status = clCreateTracingHandleINTEL(testedClDevice, nullptr, nullptr, &handle);
EXPECT_EQ(static_cast<cl_tracing_handle>(nullptr), handle);
EXPECT_EQ(CL_INVALID_VALUE, status);
}
TEST_F(IntelTracingTest, GivenInvalidHandlePointerExpectFail) {
status = clCreateTracingHandleINTEL(devices[testedRootDeviceIndex], callback, nullptr, nullptr);
status = clCreateTracingHandleINTEL(testedClDevice, callback, nullptr, nullptr);
EXPECT_EQ(CL_INVALID_VALUE, status);
}
@@ -78,7 +78,7 @@ TEST_F(IntelTracingTest, GivenInvalidHandleExpectFail) {
}
TEST_F(IntelTracingTest, GivenInactiveHandleExpectFail) {
status = clCreateTracingHandleINTEL(devices[testedRootDeviceIndex], callback, nullptr, &handle);
status = clCreateTracingHandleINTEL(testedClDevice, callback, nullptr, &handle);
EXPECT_EQ(CL_SUCCESS, status);
status = clDisableTracingINTEL(handle);
@@ -92,7 +92,7 @@ TEST_F(IntelTracingTest, GivenTooManyHandlesExpectFail) {
cl_tracing_handle handle[HostSideTracing::TRACING_MAX_HANDLE_COUNT + 1] = {nullptr};
for (uint32_t i = 0; i < HostSideTracing::TRACING_MAX_HANDLE_COUNT + 1; ++i) {
status = clCreateTracingHandleINTEL(devices[testedRootDeviceIndex], callback, nullptr, &(handle[i]));
status = clCreateTracingHandleINTEL(testedClDevice, callback, nullptr, &(handle[i]));
EXPECT_EQ(CL_SUCCESS, status);
}
@@ -116,7 +116,7 @@ TEST_F(IntelTracingTest, GivenTooManyHandlesExpectFail) {
}
TEST_F(IntelTracingTest, EnableTracingExpectPass) {
status = clCreateTracingHandleINTEL(devices[testedRootDeviceIndex], callback, this, &handle);
status = clCreateTracingHandleINTEL(testedClDevice, callback, this, &handle);
EXPECT_EQ(CL_SUCCESS, status);
status = clSetTracingPointINTEL(handle, CL_FUNCTION_clBuildProgram, CL_TRUE);
@@ -150,10 +150,10 @@ TEST_F(IntelTracingTest, EnableTracingExpectPass) {
TEST_F(IntelTracingTest, EnableTwoHandlesExpectPass) {
cl_tracing_handle handle1 = nullptr;
status = clCreateTracingHandleINTEL(devices[testedRootDeviceIndex], callback, this, &handle1);
status = clCreateTracingHandleINTEL(testedClDevice, callback, this, &handle1);
EXPECT_EQ(CL_SUCCESS, status);
cl_tracing_handle handle2 = nullptr;
status = clCreateTracingHandleINTEL(devices[testedRootDeviceIndex], callback, this, &handle2);
status = clCreateTracingHandleINTEL(testedClDevice, callback, this, &handle2);
EXPECT_EQ(CL_SUCCESS, status);
status = clSetTracingPointINTEL(handle1, CL_FUNCTION_clBuildProgram, CL_TRUE);
@@ -192,7 +192,7 @@ struct IntelAllTracingTest : public IntelTracingTest {
void SetUp() override {
IntelTracingTest::SetUp();
status = clCreateTracingHandleINTEL(devices[testedRootDeviceIndex], callback, this, &handle);
status = clCreateTracingHandleINTEL(testedClDevice, callback, this, &handle);
ASSERT_NE(nullptr, handle);
ASSERT_EQ(CL_SUCCESS, status);
@@ -290,7 +290,7 @@ struct IntelAllTracingTest : public IntelTracingTest {
functionId = CL_FUNCTION_clCreateProgramWithBinary;
const size_t length = 32;
unsigned char binary[length] = {0};
clCreateProgramWithBinary(0, 0, &(devices[testedRootDeviceIndex]), &length, reinterpret_cast<const unsigned char **>(&binary), 0, 0);
clCreateProgramWithBinary(0, 0, &(testedClDevice), &length, reinterpret_cast<const unsigned char **>(&binary), 0, 0);
++count;
functionId = CL_FUNCTION_clCreateProgramWithBuiltInKernels;
@@ -750,7 +750,7 @@ struct IntelClGetDeviceInfoTracingCollectTest : public IntelAllTracingTest {
};
TEST_F(IntelClGetDeviceInfoTracingCollectTest, GeneralTracingCollectionExpectPass) {
call(devices[testedRootDeviceIndex]);
call(testedClDevice);
EXPECT_EQ(CL_SUCCESS, status);
EXPECT_LT(0u, paramValueSizeRet);
@@ -785,7 +785,7 @@ struct IntelClGetDeviceInfoTracingChangeParamsTest : public IntelAllTracingTest
TEST_F(IntelClGetDeviceInfoTracingChangeParamsTest, GeneralTracingWithParamsChangeExpectPass) {
paramValue[0] = '\0';
call(devices[testedRootDeviceIndex]);
call(testedClDevice);
EXPECT_EQ(CL_SUCCESS, status);
EXPECT_LT(0u, paramValueSizeRet);
EXPECT_STRNE("", paramValue);
@@ -814,7 +814,7 @@ struct IntelClGetDeviceInfoTracingChangeRetValTest : public IntelAllTracingTest
};
TEST_F(IntelClGetDeviceInfoTracingChangeRetValTest, GeneralTracingWithRetValChangeExpectPass) {
call(devices[testedRootDeviceIndex]);
call(testedClDevice);
EXPECT_EQ(CL_INVALID_VALUE, status);
EXPECT_LT(0u, paramValueSizeRet);
}
@@ -826,7 +826,7 @@ struct IntelClGetDeviceInfoTwoHandlesTracingCollectTest : public IntelClGetDevic
void SetUp() override {
IntelClGetDeviceInfoTracingCollectTest::SetUp();
status = clCreateTracingHandleINTEL(devices[testedRootDeviceIndex], callback, this, &secondHandle);
status = clCreateTracingHandleINTEL(testedClDevice, callback, this, &secondHandle);
ASSERT_NE(nullptr, secondHandle);
ASSERT_EQ(CL_SUCCESS, status);
@@ -852,7 +852,7 @@ struct IntelClGetDeviceInfoTwoHandlesTracingCollectTest : public IntelClGetDevic
};
TEST_F(IntelClGetDeviceInfoTwoHandlesTracingCollectTest, GeneralTracingCollectionWithTwoHandlesExpectPass) {
call(devices[testedRootDeviceIndex]);
call(testedClDevice);
EXPECT_EQ(CL_SUCCESS, status);
EXPECT_LT(0u, paramValueSizeRet);

View File

@@ -49,8 +49,8 @@ TEST_F(clLinkProgramTests, GivenValidParamsWhenLinkingProgramThenSuccessIsReturn
retVal = clCompileProgram(
pProgram,
num_devices,
devices,
1,
&testedClDevice,
nullptr,
0,
nullptr,
@@ -64,8 +64,8 @@ TEST_F(clLinkProgramTests, GivenValidParamsWhenLinkingProgramThenSuccessIsReturn
cl_program oprog;
oprog = clLinkProgram(
pContext,
num_devices,
devices,
1,
&testedClDevice,
nullptr,
1,
&program,
@@ -109,8 +109,8 @@ TEST_F(clLinkProgramTests, GivenCreateLibraryOptionWhenLinkingProgramThenSuccess
retVal = clCompileProgram(
pProgram,
num_devices,
devices,
1,
&testedClDevice,
nullptr,
0,
nullptr,
@@ -124,8 +124,8 @@ TEST_F(clLinkProgramTests, GivenCreateLibraryOptionWhenLinkingProgramThenSuccess
cl_program oprog;
oprog = clLinkProgram(
pContext,
num_devices,
devices,
1,
&testedClDevice,
CompilerOptions::createLibrary,
1,
&program,
@@ -147,8 +147,8 @@ TEST_F(clLinkProgramTests, GivenNullContextWhenLinkingProgramThenClInvalidContex
cl_program oprog;
oprog = clLinkProgram(
nullptr,
num_devices,
devices,
1,
&testedClDevice,
nullptr,
1,
&program,

View File

@@ -52,11 +52,11 @@ typedef api_tests clReleaseCommandQueueTests;
TEST_F(clReleaseCommandQueueTests, givenBlockedEnqueueWithOutputEventStoredAsVirtualEventWhenReleasingCmdQueueThenInternalRefCountIsDecrementedAndQueueDeleted) {
cl_command_queue cmdQ = nullptr;
cl_queue_properties properties = 0;
ClDevice *device = (ClDevice *)devices[testedRootDeviceIndex];
ClDevice *device = (ClDevice *)testedClDevice;
MockKernelWithInternals kernelInternals(*device, pContext);
Kernel *kernel = kernelInternals.mockKernel;
cmdQ = clCreateCommandQueue(pContext, devices[testedRootDeviceIndex], properties, &retVal);
cmdQ = clCreateCommandQueue(pContext, testedClDevice, properties, &retVal);
ASSERT_NE(nullptr, cmdQ);
ASSERT_EQ(CL_SUCCESS, retVal);

View File

@@ -37,15 +37,14 @@ TEST_F(clReleaseKernelTests, GivenRetainedKernelWhenReleasingKernelThenKernelIsC
ASSERT_NE(nullptr, binary);
unsigned const char *binaries[1] = {reinterpret_cast<const unsigned char *>(binary.get())};
program = clCreateProgramWithBinary(pContext, num_devices, devices, &binarySize,
binaries, &binaryStatus, &retVal);
program = clCreateProgramWithBinary(pContext, 1, &testedClDevice, &binarySize, binaries, &binaryStatus, &retVal);
binary.reset();
EXPECT_NE(nullptr, program);
ASSERT_EQ(CL_SUCCESS, retVal);
retVal = clBuildProgram(program, num_devices, devices, nullptr, nullptr, nullptr);
retVal = clBuildProgram(program, 1, &testedClDevice, nullptr, nullptr, nullptr);
ASSERT_EQ(CL_SUCCESS, retVal);

View File

@@ -23,14 +23,14 @@ TEST_F(clRetainReleaseDeviceTests, GivenRootDeviceWhenRetainingThenReferenceCoun
EXPECT_EQ(CL_SUCCESS, retVal);
retVal = clRetainDevice(devices[testedRootDeviceIndex]);
retVal = clRetainDevice(testedClDevice);
EXPECT_EQ(CL_SUCCESS, retVal);
retVal = clRetainDevice(devices[testedRootDeviceIndex]);
retVal = clRetainDevice(testedClDevice);
EXPECT_EQ(CL_SUCCESS, retVal);
cl_uint theRef;
retVal = clGetDeviceInfo(devices[testedRootDeviceIndex], CL_DEVICE_REFERENCE_COUNT,
retVal = clGetDeviceInfo(testedClDevice, CL_DEVICE_REFERENCE_COUNT,
sizeof(cl_uint), &theRef, NULL);
EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_EQ(1u, theRef);
@@ -45,14 +45,14 @@ TEST_F(clRetainReleaseDeviceTests, GivenRootDeviceWhenReleasingThenReferenceCoun
EXPECT_EQ(CL_SUCCESS, retVal);
retVal = clReleaseDevice(devices[testedRootDeviceIndex]);
retVal = clReleaseDevice(testedClDevice);
EXPECT_EQ(CL_SUCCESS, retVal);
retVal = clReleaseDevice(devices[testedRootDeviceIndex]);
retVal = clReleaseDevice(testedClDevice);
EXPECT_EQ(CL_SUCCESS, retVal);
cl_uint theRef;
retVal = clGetDeviceInfo(devices[testedRootDeviceIndex], CL_DEVICE_REFERENCE_COUNT,
retVal = clGetDeviceInfo(testedClDevice, CL_DEVICE_REFERENCE_COUNT,
sizeof(cl_uint), &theRef, NULL);
EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_EQ(1u, theRef);

View File

@@ -27,7 +27,7 @@ struct clSetDefaultDeviceCommandQueueApiTest : public api_tests {
CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE | CL_QUEUE_ON_DEVICE,
0,
0};
deviceQueue = clCreateCommandQueueWithProperties(pContext, devices[testedRootDeviceIndex], properties, &retVal);
deviceQueue = clCreateCommandQueueWithProperties(pContext, testedClDevice, properties, &retVal);
if (!pContext->getDevice(0u)->getHardwareInfo().capabilityTable.supportsDeviceEnqueue) {
ASSERT_EQ(nullptr, deviceQueue);
@@ -51,7 +51,7 @@ struct clSetDefaultDeviceCommandQueueApiTest : public api_tests {
};
HWCMDTEST_F(IGFX_GEN8_CORE, clSetDefaultDeviceCommandQueueApiTest, GivenValidParamsWhenSettingDefaultDeviceQueueThenSuccessIsReturned) {
retVal = clSetDefaultDeviceCommandQueue(pContext, devices[testedRootDeviceIndex], deviceQueue);
retVal = clSetDefaultDeviceCommandQueue(pContext, testedClDevice, deviceQueue);
EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_EQ(static_cast<_device_queue *>(deviceQueue), static_cast<_device_queue *>(pContext->getDefaultDeviceQueue()));
@@ -62,14 +62,14 @@ HWCMDTEST_F(IGFX_GEN8_CORE, clSetDefaultDeviceCommandQueueApiTest, GivenValidPar
CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE | CL_QUEUE_ON_DEVICE,
0,
0};
auto pDevice = castToObject<ClDevice>(devices[testedRootDeviceIndex]);
auto pDevice = castToObject<ClDevice>(testedClDevice);
if (pDevice->getSharedDeviceInfo().maxOnDeviceQueues > 1) {
auto newDeviceQueue = clCreateCommandQueueWithProperties(pContext, devices[testedRootDeviceIndex], properties, &retVal);
auto newDeviceQueue = clCreateCommandQueueWithProperties(pContext, testedClDevice, properties, &retVal);
ASSERT_NE(nullptr, newDeviceQueue);
ASSERT_EQ(CL_SUCCESS, retVal);
retVal = clSetDefaultDeviceCommandQueue(pContext, devices[testedRootDeviceIndex], newDeviceQueue);
retVal = clSetDefaultDeviceCommandQueue(pContext, testedClDevice, newDeviceQueue);
EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_EQ(static_cast<_device_queue *>(newDeviceQueue), static_cast<_device_queue *>(pContext->getDefaultDeviceQueue()));
@@ -79,7 +79,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, clSetDefaultDeviceCommandQueueApiTest, GivenValidPar
}
HWCMDTEST_F(IGFX_GEN8_CORE, clSetDefaultDeviceCommandQueueApiTest, GivenNullContextWhenSettingDefaultDeviceQueueThenClInvalidContextErrorIsReturned) {
retVal = clSetDefaultDeviceCommandQueue(nullptr, devices[testedRootDeviceIndex], deviceQueue);
retVal = clSetDefaultDeviceCommandQueue(nullptr, testedClDevice, deviceQueue);
ASSERT_EQ(CL_INVALID_CONTEXT, retVal);
}
@@ -89,17 +89,17 @@ HWCMDTEST_F(IGFX_GEN8_CORE, clSetDefaultDeviceCommandQueueApiTest, GivenNullDevi
}
HWCMDTEST_F(IGFX_GEN8_CORE, clSetDefaultDeviceCommandQueueApiTest, GivenNullDeviceQueueWhenSettingDefaultDeviceQueueThenClInvalidCommandQueueErrorIsReturned) {
retVal = clSetDefaultDeviceCommandQueue(pContext, devices[testedRootDeviceIndex], nullptr);
retVal = clSetDefaultDeviceCommandQueue(pContext, testedClDevice, nullptr);
ASSERT_EQ(CL_INVALID_COMMAND_QUEUE, retVal);
}
HWCMDTEST_F(IGFX_GEN8_CORE, clSetDefaultDeviceCommandQueueApiTest, GivenHostQueueAsDeviceQueueWhenSettingDefaultDeviceQueueThenClInvalidCommandQueueErrorIsReturned) {
cl_queue_properties properties[] = {CL_QUEUE_PROPERTIES, 0, 0, 0};
cl_command_queue hostQueue = clCreateCommandQueueWithProperties(pContext, devices[testedRootDeviceIndex], properties, &retVal);
cl_command_queue hostQueue = clCreateCommandQueueWithProperties(pContext, testedClDevice, properties, &retVal);
ASSERT_NE(nullptr, hostQueue);
ASSERT_EQ(CL_SUCCESS, retVal);
retVal = clSetDefaultDeviceCommandQueue(pContext, devices[testedRootDeviceIndex], hostQueue);
retVal = clSetDefaultDeviceCommandQueue(pContext, testedClDevice, hostQueue);
ASSERT_EQ(CL_INVALID_COMMAND_QUEUE, retVal);
retVal = clReleaseCommandQueue(hostQueue);
@@ -113,11 +113,11 @@ HWCMDTEST_F(IGFX_GEN8_CORE, clSetDefaultDeviceCommandQueueApiTest, GivenIncorrec
CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE | CL_QUEUE_ON_DEVICE,
0,
0};
cl_command_queue deviceQueueCtx2 = clCreateCommandQueueWithProperties(context2, devices[testedRootDeviceIndex], properties, &retVal);
cl_command_queue deviceQueueCtx2 = clCreateCommandQueueWithProperties(context2, testedClDevice, properties, &retVal);
ASSERT_NE(nullptr, deviceQueueCtx2);
ASSERT_EQ(CL_SUCCESS, retVal);
retVal = clSetDefaultDeviceCommandQueue(pContext, devices[testedRootDeviceIndex], deviceQueueCtx2);
retVal = clSetDefaultDeviceCommandQueue(pContext, testedClDevice, deviceQueueCtx2);
ASSERT_EQ(CL_INVALID_COMMAND_QUEUE, retVal);
retVal = clReleaseCommandQueue(deviceQueueCtx2);

View File

@@ -21,9 +21,9 @@ class KernelExecInfoFixture : public ApiFixture<> {
pKernelInfo = std::make_unique<KernelInfo>();
pMockKernel = new MockKernel(pProgram, *pKernelInfo, *pPlatform->getClDevice(testedRootDeviceIndex));
pMockKernel = new MockKernel(pProgram, *pKernelInfo, *pDevice);
ASSERT_EQ(CL_SUCCESS, pMockKernel->initialize());
svmCapabilities = pPlatform->getClDevice(testedRootDeviceIndex)->getDeviceInfo().svmCapabilities;
svmCapabilities = pDevice->getDeviceInfo().svmCapabilities;
if (svmCapabilities != 0) {
ptrSvm = clSVMAlloc(pContext, CL_MEM_READ_WRITE, 256, 4);
EXPECT_NE(nullptr, ptrSvm);

View File

@@ -26,7 +26,7 @@ class clSVMAllocTemplateTests : public ApiFixture<>,
public:
void SetUp() override {
ApiFixture::SetUp();
REQUIRE_SVM_OR_SKIP(pPlatform->getClDevice(testedRootDeviceIndex));
REQUIRE_SVM_OR_SKIP(pDevice);
}
void TearDown() override {
@@ -61,7 +61,7 @@ TEST(clSVMAllocTest, givenPlatformWithoutDevicesWhenClSVMAllocIsCalledThenDevice
TEST_P(clSVMAllocValidFlagsTests, GivenSvmSupportWhenAllocatingSvmThenSvmIsAllocated) {
cl_mem_flags flags = GetParam();
const ClDeviceInfo &devInfo = pPlatform->getClDevice(0)->getDeviceInfo();
const ClDeviceInfo &devInfo = pDevice->getDeviceInfo();
//check for svm support
if (devInfo.svmCapabilities != 0) {
//fg svm flag
@@ -120,7 +120,7 @@ INSTANTIATE_TEST_CASE_P(
testing::ValuesIn(SVMAllocValidFlags));
TEST_P(clSVMAllocFtrFlagsTests, GivenCorrectFlagsWhenAllocatingSvmThenSvmIsAllocated) {
HardwareInfo *pHwInfo = pPlatform->peekExecutionEnvironment()->rootDeviceEnvironments[testedRootDeviceIndex]->getMutableHardwareInfo();
HardwareInfo *pHwInfo = pDevice->getExecutionEnvironment()->rootDeviceEnvironments[testedRootDeviceIndex]->getMutableHardwareInfo();
cl_mem_flags flags = GetParam();
void *SVMPtr = nullptr;
@@ -185,7 +185,7 @@ TEST_F(clSVMAllocTests, GivenZeroSizeWhenAllocatingSvmThenSvmIsNotAllocated) {
}
TEST_F(clSVMAllocTests, GivenZeroAlignmentWhenAllocatingSvmThenSvmIsAllocated) {
const ClDeviceInfo &devInfo = pPlatform->getClDevice(0)->getDeviceInfo();
const ClDeviceInfo &devInfo = pDevice->getDeviceInfo();
if (devInfo.svmCapabilities != 0) {
cl_mem_flags flags = CL_MEM_READ_WRITE;
auto SVMPtr = clSVMAlloc(pContext /* cl_context */, flags, 4096 /* Size*/, 0 /* alignment */);
@@ -195,7 +195,7 @@ TEST_F(clSVMAllocTests, GivenZeroAlignmentWhenAllocatingSvmThenSvmIsAllocated) {
}
TEST_F(clSVMAllocTests, GivenUnalignedSizeAndDefaultAlignmentWhenAllocatingSvmThenSvmIsAllocated) {
const ClDeviceInfo &devInfo = pPlatform->getClDevice(0)->getDeviceInfo();
const ClDeviceInfo &devInfo = pDevice->getDeviceInfo();
if (devInfo.svmCapabilities != 0) {
cl_mem_flags flags = CL_MEM_READ_WRITE;
auto SVMPtr = clSVMAlloc(pContext /* cl_context */, flags, 4095 /* Size*/, 0 /* alignment */);

View File

@@ -34,13 +34,13 @@ TEST_P(GetDeviceGlInfoStr, StringType) {
char *paramValue = nullptr;
size_t paramRetSize = 0;
cl_int retVal = clGetDeviceInfo(devices[0], param, 0, nullptr, &paramRetSize);
cl_int retVal = clGetDeviceInfo(testedClDevice, param, 0, nullptr, &paramRetSize);
EXPECT_EQ(CL_SUCCESS, retVal);
ASSERT_NE(0u, paramRetSize);
paramValue = new char[paramRetSize];
retVal = clGetDeviceInfo(devices[0], param, paramRetSize, paramValue, nullptr);
retVal = clGetDeviceInfo(testedClDevice, param, paramRetSize, paramValue, nullptr);
EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_GE(std::strlen(paramValue), 0u);

View File

@@ -20,7 +20,7 @@ struct IntelGlTracingTest : public api_tests {
void SetUp() override {
api_tests::SetUp();
status = clCreateTracingHandleINTEL(devices[0], callback, this, &handle);
status = clCreateTracingHandleINTEL(testedClDevice, callback, this, &handle);
ASSERT_NE(nullptr, handle);
ASSERT_EQ(CL_SUCCESS, status);

View File

@@ -38,13 +38,13 @@ class DeviceHostQueueFixture : public ApiFixture<>,
}
cl_command_queue createClQueue(cl_queue_properties properties[5] = deviceQueueProperties::noProperties) {
return create(pContext, devices[testedRootDeviceIndex], retVal, properties);
return create(pContext, testedClDevice, retVal, properties);
}
T *createQueueObject(cl_queue_properties properties[5] = deviceQueueProperties::noProperties) {
using BaseType = typename T::BaseType;
cl_context context = (cl_context)(pContext);
auto clQueue = create(context, devices[testedRootDeviceIndex], retVal, properties);
auto clQueue = create(context, testedClDevice, retVal, properties);
return castToObject<T>(static_cast<BaseType *>(clQueue));
}
@@ -57,7 +57,7 @@ class DeviceQueueHwTest : public DeviceHostQueueFixture<DeviceQueue> {
using BaseClass = DeviceHostQueueFixture<DeviceQueue>;
void SetUp() override {
BaseClass::SetUp();
device = castToObject<ClDevice>(devices[testedRootDeviceIndex]);
device = castToObject<ClDevice>(testedClDevice);
ASSERT_NE(device, nullptr);
if (!device->getHardwareInfo().capabilityTable.supportsDeviceEnqueue) {
GTEST_SKIP();

View File

@@ -14,11 +14,9 @@
using namespace NEO;
using namespace DeviceHostQueue;
struct KernelArgDevQueueTest : public DeviceFixture,
public DeviceHostQueueFixture<DeviceQueue> {
struct KernelArgDevQueueTest : public DeviceHostQueueFixture<DeviceQueue> {
protected:
void SetUp() override {
DeviceFixture::SetUp();
DeviceHostQueueFixture<DeviceQueue>::SetUp();
if (!this->pDevice->getHardwareInfo().capabilityTable.supportsDeviceEnqueue) {
GTEST_SKIP();
@@ -37,7 +35,7 @@ struct KernelArgDevQueueTest : public DeviceFixture,
pKernelInfo->kernelArgInfo[0].kernelArgPatchInfoVector.push_back(kernelArgPatchInfo);
program = std::make_unique<MockProgram>(*pDevice->getExecutionEnvironment());
pKernel = new MockKernel(program.get(), *pKernelInfo, *pClDevice);
pKernel = new MockKernel(program.get(), *pKernelInfo, *pDevice);
ASSERT_EQ(CL_SUCCESS, pKernel->initialize());
uint8_t pCrossThreadData[crossThreadDataSize];
@@ -51,7 +49,6 @@ struct KernelArgDevQueueTest : public DeviceFixture,
delete pDeviceQueue;
DeviceHostQueueFixture<DeviceQueue>::TearDown();
DeviceFixture::TearDown();
}
bool crossThreadDataUnchanged() {

View File

@@ -42,11 +42,11 @@ struct IntelTracingMtTest : public api_tests {
for (int i = 0; i < iterationCount; ++i) {
HostSideTracing::AtomicBackoff backoff;
status = clGetDeviceInfo(devices[testedRootDeviceIndex], CL_DEVICE_NAME, maxStrSize, buffer, nullptr);
status = clGetDeviceInfo(testedClDevice, CL_DEVICE_NAME, maxStrSize, buffer, nullptr);
EXPECT_EQ(CL_SUCCESS, status);
backoff.pause();
status = clGetDeviceInfo(devices[testedRootDeviceIndex], CL_DEVICE_PLATFORM, sizeof(cl_platform_id), &platform, nullptr);
status = clGetDeviceInfo(testedClDevice, CL_DEVICE_PLATFORM, sizeof(cl_platform_id), &platform, nullptr);
EXPECT_EQ(CL_SUCCESS, status);
backoff.pause();
@@ -82,7 +82,7 @@ struct IntelTracingMtTest : public api_tests {
};
TEST_F(IntelTracingMtTest, SafeTracingFromMultipleThreads) {
status = clCreateTracingHandleINTEL(devices[testedRootDeviceIndex], callback, this, &handle);
status = clCreateTracingHandleINTEL(testedClDevice, callback, this, &handle);
EXPECT_EQ(CL_SUCCESS, status);
status = clSetTracingPointINTEL(handle, CL_FUNCTION_clGetDeviceInfo, CL_TRUE);