diff --git a/opencl/source/platform/platform.cpp b/opencl/source/platform/platform.cpp index afaac2152f..00f7127b64 100644 --- a/opencl/source/platform/platform.cpp +++ b/opencl/source/platform/platform.cpp @@ -188,19 +188,6 @@ bool Platform::isInitialized() { return ret; } -Device *Platform::getDevice(size_t deviceOrdinal) { - TakeOwnershipWrapper platformOwnership(*this); - - if (this->state != StateInited || deviceOrdinal >= clDevices.size()) { - return nullptr; - } - - auto pDevice = &clDevices[deviceOrdinal]->getDevice(); - DEBUG_BREAK_IF(pDevice == nullptr); - - return pDevice; -} - ClDevice *Platform::getClDevice(size_t deviceOrdinal) { TakeOwnershipWrapper platformOwnership(*this); diff --git a/opencl/source/platform/platform.h b/opencl/source/platform/platform.h index 4f1dd0889f..0e9d0e450f 100644 --- a/opencl/source/platform/platform.h +++ b/opencl/source/platform/platform.h @@ -51,7 +51,6 @@ class Platform : public BaseObject<_cl_platform_id> { bool isInitialized(); size_t getNumDevices() const; - Device *getDevice(size_t deviceOrdinal); ClDevice **getClDevices(); ClDevice *getClDevice(size_t deviceOrdinal); diff --git a/opencl/test/unit_test/api/cl_get_device_info_tests.inl b/opencl/test/unit_test/api/cl_get_device_info_tests.inl index a522de35d0..fc28d5b8bd 100644 --- a/opencl/test/unit_test/api/cl_get_device_info_tests.inl +++ b/opencl/test/unit_test/api/cl_get_device_info_tests.inl @@ -95,7 +95,7 @@ TEST_F(clGetDeviceInfoTests, givenOpenCLDeviceWhenAskedForSupportedSvmTypeCorrec nullptr); EXPECT_EQ(CL_SUCCESS, retVal); - const HardwareInfo &hwInfo = pPlatform->getDevice(testedRootDeviceIndex)->getHardwareInfo(); + const HardwareInfo &hwInfo = pPlatform->getClDevice(testedRootDeviceIndex)->getHardwareInfo(); cl_device_svm_capabilities expectedCaps = 0; if (hwInfo.capabilityTable.ftrSvm != 0) { diff --git a/opencl/test/unit_test/api/cl_get_platform_info_tests.inl b/opencl/test/unit_test/api/cl_get_platform_info_tests.inl index 267b66ddaa..863d07d8e3 100644 --- a/opencl/test/unit_test/api/cl_get_platform_info_tests.inl +++ b/opencl/test/unit_test/api/cl_get_platform_info_tests.inl @@ -116,7 +116,7 @@ TEST_F(clGetPlatformInfoTests, GivenClPlatformHostTimerResolutionWhenGettingPlat retVal = clGetPlatformInfo(pPlatform, CL_PLATFORM_HOST_TIMER_RESOLUTION, retSize, &value, nullptr); EXPECT_EQ(CL_SUCCESS, retVal); - auto device = pPlatform->getDevice(0); + auto device = pPlatform->getClDevice(0); cl_ulong resolution = static_cast(device->getPlatformHostTimerResolution()); EXPECT_EQ(resolution, value); } diff --git a/opencl/test/unit_test/context/driver_diagnostics_enqueue_tests.cpp b/opencl/test/unit_test/context/driver_diagnostics_enqueue_tests.cpp index 2f4cbef1d9..7989db8d47 100644 --- a/opencl/test/unit_test/context/driver_diagnostics_enqueue_tests.cpp +++ b/opencl/test/unit_test/context/driver_diagnostics_enqueue_tests.cpp @@ -662,7 +662,7 @@ TEST_P(PerformanceHintEnqueueMapTest, GivenZeroCopyFlagWhenEnqueueUnmapIsCalling } TEST_F(PerformanceHintEnqueueTest, GivenSVMPointerWhenEnqueueSVMMapIsCallingThenContextProvidesProperHint) { - if (!pPlatform->getDevice(0)->getHardwareInfo().capabilityTable.ftrSvm) { + if (!pPlatform->getClDevice(0)->getHardwareInfo().capabilityTable.ftrSvm) { GTEST_SKIP(); } void *svmPtr = context->getSVMAllocsManager()->createSVMAlloc(0, 256, {}); @@ -778,7 +778,7 @@ TEST_P(PerformanceHintEnqueueKernelBadSizeTest, GivenBadLocalWorkGroupSizeWhenEn TEST_F(PerformanceHintEnqueueKernelPrintfTest, GivenKernelWithPrintfWhenEnqueueKernelIsCalledWithWorkDim3ThenContextProvidesProperHint) { size_t preferredWorkGroupSize[3]; - auto maxWorkGroupSize = static_cast(pPlatform->getDevice(0)->getDeviceInfo().maxWorkGroupSize); + auto maxWorkGroupSize = static_cast(pPlatform->getClDevice(0)->getSharedDeviceInfo().maxWorkGroupSize); if (DebugManager.flags.EnableComputeWorkSizeND.get()) { WorkSizeInfo wsInfo(maxWorkGroupSize, 0u, 32u, 0u, IGFX_GEN9_CORE, 32u, 0u, false, false); computeWorkgroupSizeND(wsInfo, preferredWorkGroupSize, globalWorkGroupSize, 2); @@ -794,7 +794,7 @@ TEST_F(PerformanceHintEnqueueKernelPrintfTest, GivenKernelWithPrintfWhenEnqueueK TEST_F(PerformanceHintEnqueueTest, GivenKernelWithCoherentPtrWhenEnqueueKernelIsCalledWithWorkDim2ThenContextProvidesProperHint) { size_t preferredWorkGroupSize[3]; size_t globalWorkGroupSize[3] = {1, 1, 1}; - auto maxWorkGroupSize = static_cast(pPlatform->getDevice(0)->getDeviceInfo().maxWorkGroupSize); + auto maxWorkGroupSize = static_cast(pPlatform->getClDevice(0)->getSharedDeviceInfo().maxWorkGroupSize); MockKernelWithInternals mockKernel(*pPlatform->getClDevice(0), context); Kernel::SimpleKernelArgInfo kernelArgInfo; diff --git a/opencl/test/unit_test/d3d_sharing/d3d9_tests.cpp b/opencl/test/unit_test/d3d_sharing/d3d9_tests.cpp index 3ea2081f52..16133239a0 100644 --- a/opencl/test/unit_test/d3d_sharing/d3d9_tests.cpp +++ b/opencl/test/unit_test/d3d_sharing/d3d9_tests.cpp @@ -82,7 +82,7 @@ class D3D9Tests : public PlatformFixture, public ::testing::Test { imgDesc.image_depth = 1; imgDesc.image_type = CL_MEM_OBJECT_IMAGE2D; auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr); - gmm = MockGmm::queryImgParams(pPlatform->getDevice(0)->getGmmClientContext(), imgInfo).release(); + gmm = MockGmm::queryImgParams(pPlatform->getClDevice(0)->getGmmClientContext(), imgInfo).release(); mockGmmResInfo = reinterpret_cast *>(gmm->gmmResourceInfo.get()); memoryManager->forceGmm = gmm; diff --git a/opencl/test/unit_test/device/sub_device_tests.cpp b/opencl/test/unit_test/device/sub_device_tests.cpp index 104b31e6dd..0717fac706 100644 --- a/opencl/test/unit_test/device/sub_device_tests.cpp +++ b/opencl/test/unit_test/device/sub_device_tests.cpp @@ -108,8 +108,8 @@ TEST(SubDevicesTest, givenCreateMultipleRootDevicesFlagsEnabledWhenDevicesAreCre VariableBackup backup{&ultHwConfig}; ultHwConfig.useMockedGetDevicesFunc = false; initPlatform(); - EXPECT_EQ(0u, platform()->getDevice(0)->getRootDeviceIndex()); - EXPECT_EQ(1u, platform()->getDevice(1)->getRootDeviceIndex()); + EXPECT_EQ(0u, platform()->getClDevice(0)->getRootDeviceIndex()); + EXPECT_EQ(1u, platform()->getClDevice(1)->getRootDeviceIndex()); } TEST(SubDevicesTest, givenRootDeviceWithSubDevicesWhenOsContextIsCreatedThenItsBitfieldBasesOnSubDevicesCount) { diff --git a/opencl/test/unit_test/execution_environment/execution_environment_tests.cpp b/opencl/test/unit_test/execution_environment/execution_environment_tests.cpp index e364801319..a314406baf 100644 --- a/opencl/test/unit_test/execution_environment/execution_environment_tests.cpp +++ b/opencl/test/unit_test/execution_environment/execution_environment_tests.cpp @@ -54,17 +54,16 @@ TEST(ExecutionEnvironment, givenPlatformAndExecutionEnvironmentWithRefCountsWhen executionEnvironment->decRefInternal(); } -TEST(ExecutionEnvironment, givenPlatformWhenItIsInitializedAndCreatesDevicesThenThoseDevicesAddRefcountsToExecutionEnvironment) { +TEST(ExecutionEnvironment, WhenCreatingDevicesThenThoseDevicesAddRefcountsToExecutionEnvironment) { auto executionEnvironment = new ExecutionEnvironment(); - std::unique_ptr platform(new Platform(*executionEnvironment)); auto expectedRefCounts = executionEnvironment->getRefInternalCount(); - platform->initialize(DeviceFactory::createDevices(*executionEnvironment)); - EXPECT_LT(0u, platform->getDevice(0)->getNumAvailableDevices()); - if (platform->getDevice(0)->getNumAvailableDevices() > 1) { + auto devices = DeviceFactory::createDevices(*executionEnvironment); + EXPECT_LT(0u, devices[0]->getNumAvailableDevices()); + if (devices[0]->getNumAvailableDevices() > 1) { expectedRefCounts++; } - expectedRefCounts += platform->getDevice(0)->getNumAvailableDevices(); + expectedRefCounts += devices[0]->getNumAvailableDevices(); EXPECT_EQ(expectedRefCounts, executionEnvironment->getRefInternalCount()); } diff --git a/opencl/test/unit_test/gen9/test_platform_caps_gen9.cpp b/opencl/test/unit_test/gen9/test_platform_caps_gen9.cpp index fad3187077..772adc309f 100644 --- a/opencl/test/unit_test/gen9/test_platform_caps_gen9.cpp +++ b/opencl/test/unit_test/gen9/test_platform_caps_gen9.cpp @@ -5,8 +5,7 @@ * */ -#include "shared/source/device/device.h" - +#include "opencl/source/device/cl_device.h" #include "opencl/test/unit_test/fixtures/platform_fixture.h" #include "test.h" @@ -24,7 +23,7 @@ struct Gen9PlatformCaps : public PlatformFixture, public ::testing::Test { GEN9TEST_F(Gen9PlatformCaps, allSkusSupportFP64) { const auto &caps = pPlatform->getPlatformInfo(); - if (pPlatform->getDevice(0)->getHardwareInfo().capabilityTable.ftrSupportsFP64) { + if (pPlatform->getClDevice(0)->getHardwareInfo().capabilityTable.ftrSupportsFP64) { EXPECT_NE(std::string::npos, caps.extensions.find(std::string("cl_khr_fp64"))); } else { EXPECT_EQ(std::string::npos, caps.extensions.find(std::string("cl_khr_fp64"))); @@ -34,7 +33,7 @@ GEN9TEST_F(Gen9PlatformCaps, allSkusSupportFP64) { GEN9TEST_F(Gen9PlatformCaps, SKLVersion) { char *paramValue = new char[12]; cl_int retVal = clGetPlatformInfo(pPlatform, CL_PLATFORM_VERSION, 12, paramValue, nullptr); - if (pPlatform->getDevice(0)->getHardwareInfo().platform.eProductFamily == IGFX_SKYLAKE) { + if (pPlatform->getClDevice(0)->getHardwareInfo().platform.eProductFamily == IGFX_SKYLAKE) { EXPECT_STREQ(paramValue, "OpenCL 2.1 "); } EXPECT_EQ(retVal, CL_SUCCESS); @@ -44,7 +43,7 @@ GEN9TEST_F(Gen9PlatformCaps, SKLVersion) { GEN9TEST_F(Gen9PlatformCaps, BXTVersion) { char *paramValue = new char[12]; cl_int retVal = clGetPlatformInfo(pPlatform, CL_PLATFORM_VERSION, 12, paramValue, nullptr); - if (pPlatform->getDevice(0)->getHardwareInfo().platform.eProductFamily == IGFX_BROXTON) { + if (pPlatform->getClDevice(0)->getHardwareInfo().platform.eProductFamily == IGFX_BROXTON) { EXPECT_STREQ(paramValue, "OpenCL 1.2 "); } EXPECT_EQ(retVal, CL_SUCCESS); diff --git a/opencl/test/unit_test/kernel/kernel_reflection_surface_tests.cpp b/opencl/test/unit_test/kernel/kernel_reflection_surface_tests.cpp index faa592dfb6..1805e4637e 100644 --- a/opencl/test/unit_test/kernel/kernel_reflection_surface_tests.cpp +++ b/opencl/test/unit_test/kernel/kernel_reflection_surface_tests.cpp @@ -66,7 +66,7 @@ TEST_P(KernelReflectionSurfaceTest, GivenEmptyKernelInfoWhenPassedToGetCurbePara std::vector curbeParamsForBlock; uint64_t tokenMask = 0; uint32_t firstSSHTokenIndex = 0; - MockKernel::ReflectionSurfaceHelperPublic::getCurbeParams(curbeParamsForBlock, tokenMask, firstSSHTokenIndex, info, pPlatform->getDevice(0)->getHardwareInfo()); + MockKernel::ReflectionSurfaceHelperPublic::getCurbeParams(curbeParamsForBlock, tokenMask, firstSSHTokenIndex, info, pPlatform->getClDevice(0)->getHardwareInfo()); // 3 params with Binding Table index of type 1024 EXPECT_EQ(3u, curbeParamsForBlock.size()); @@ -114,7 +114,7 @@ TEST_P(KernelReflectionSurfaceTest, GivenKernelInfoWithCorrectlyFilledImageArgum std::vector curbeParams; uint64_t tokenMask = 0; uint32_t firstSSHTokenIndex = 0; - MockKernel::ReflectionSurfaceHelperPublic::getCurbeParams(curbeParams, tokenMask, firstSSHTokenIndex, info, pPlatform->getDevice(0)->getHardwareInfo()); + MockKernel::ReflectionSurfaceHelperPublic::getCurbeParams(curbeParams, tokenMask, firstSSHTokenIndex, info, pPlatform->getClDevice(0)->getHardwareInfo()); std::vector supportedImageParamTypes = {iOpenCL::DATA_PARAMETER_IMAGE_WIDTH, iOpenCL::DATA_PARAMETER_IMAGE_HEIGHT, @@ -201,7 +201,7 @@ HWTEST_P(KernelReflectionSurfaceTest, GivenKernelInfoWithSetBindingTableStateAnd std::vector curbeParams; uint64_t tokenMask = 0; uint32_t firstSSHTokenIndex = 0; - MockKernel::ReflectionSurfaceHelperPublic::getCurbeParams(curbeParams, tokenMask, firstSSHTokenIndex, info, pPlatform->getDevice(0)->getHardwareInfo()); + MockKernel::ReflectionSurfaceHelperPublic::getCurbeParams(curbeParams, tokenMask, firstSSHTokenIndex, info, pPlatform->getClDevice(0)->getHardwareInfo()); EXPECT_NE(0u, curbeParams.size()); bool foundProperParam = false; @@ -253,7 +253,7 @@ HWTEST_P(KernelReflectionSurfaceTest, GivenKernelInfoWithBindingTableStateAndIma std::vector curbeParams; uint64_t tokenMask = 0; uint32_t firstSSHTokenIndex = 0; - MockKernel::ReflectionSurfaceHelperPublic::getCurbeParams(curbeParams, tokenMask, firstSSHTokenIndex, info, pPlatform->getDevice(0)->getHardwareInfo()); + MockKernel::ReflectionSurfaceHelperPublic::getCurbeParams(curbeParams, tokenMask, firstSSHTokenIndex, info, pPlatform->getClDevice(0)->getHardwareInfo()); EXPECT_EQ(1u, curbeParams.size()); bool foundProperParam = false; @@ -296,7 +296,7 @@ TEST_P(KernelReflectionSurfaceTest, GivenKernelInfoWithCorrectlyFilledSamplerArg std::vector curbeParams; uint64_t tokenMask = 0; uint32_t firstSSHTokenIndex = 0; - MockKernel::ReflectionSurfaceHelperPublic::getCurbeParams(curbeParams, tokenMask, firstSSHTokenIndex, info, pPlatform->getDevice(0)->getHardwareInfo()); + MockKernel::ReflectionSurfaceHelperPublic::getCurbeParams(curbeParams, tokenMask, firstSSHTokenIndex, info, pPlatform->getClDevice(0)->getHardwareInfo()); std::vector supportedSamplerParamTypes = {iOpenCL::DATA_PARAMETER_SAMPLER_ADDRESS_MODE, iOpenCL::DATA_PARAMETER_SAMPLER_NORMALIZED_COORDS, @@ -347,7 +347,7 @@ TEST_P(KernelReflectionSurfaceTest, GivenKernelInfoWithBufferAndDataParameterBuf std::vector curbeParams; uint64_t tokenMask = 0; uint32_t firstSSHTokenIndex = 0; - MockKernel::ReflectionSurfaceHelperPublic::getCurbeParams(curbeParams, tokenMask, firstSSHTokenIndex, info, pPlatform->getDevice(0)->getHardwareInfo()); + MockKernel::ReflectionSurfaceHelperPublic::getCurbeParams(curbeParams, tokenMask, firstSSHTokenIndex, info, pPlatform->getClDevice(0)->getHardwareInfo()); EXPECT_LT(1u, curbeParams.size()); bool kernelArgumentTokenFound = false; @@ -389,7 +389,7 @@ TEST_P(KernelReflectionSurfaceTest, GivenKernelInfoWithBufferAndNoDataParameterB std::vector curbeParams; uint64_t tokenMask = 0; uint32_t firstSSHTokenIndex = 0; - MockKernel::ReflectionSurfaceHelperPublic::getCurbeParams(curbeParams, tokenMask, firstSSHTokenIndex, info, pPlatform->getDevice(0)->getHardwareInfo()); + MockKernel::ReflectionSurfaceHelperPublic::getCurbeParams(curbeParams, tokenMask, firstSSHTokenIndex, info, pPlatform->getClDevice(0)->getHardwareInfo()); bool kernelArgumentTokenFound = false; for (const auto &curbeParam : curbeParams) { @@ -429,7 +429,7 @@ TEST_P(KernelReflectionSurfaceTest, GivenKernelInfoWithLocalMemoryParameterWhenP std::vector curbeParams; uint64_t tokenMask = 0; uint32_t firstSSHTokenIndex = 0; - MockKernel::ReflectionSurfaceHelperPublic::getCurbeParams(curbeParams, tokenMask, firstSSHTokenIndex, info, pPlatform->getDevice(0)->getHardwareInfo()); + MockKernel::ReflectionSurfaceHelperPublic::getCurbeParams(curbeParams, tokenMask, firstSSHTokenIndex, info, pPlatform->getClDevice(0)->getHardwareInfo()); bool localMemoryTokenFound = false; for (const auto &curbeParam : curbeParams) { @@ -472,7 +472,7 @@ TEST_P(KernelReflectionSurfaceTest, GivenKernelInfoWithoutLocalMemoryParameterWh std::vector curbeParams; uint64_t tokenMask = 0; uint32_t firstSSHTokenIndex = 0; - MockKernel::ReflectionSurfaceHelperPublic::getCurbeParams(curbeParams, tokenMask, firstSSHTokenIndex, info, pPlatform->getDevice(0)->getHardwareInfo()); + MockKernel::ReflectionSurfaceHelperPublic::getCurbeParams(curbeParams, tokenMask, firstSSHTokenIndex, info, pPlatform->getClDevice(0)->getHardwareInfo()); bool localMemoryTokenFound = false; for (const auto &curbeParam : curbeParams) { @@ -933,7 +933,7 @@ TEST_P(KernelReflectionSurfaceTest, GivenKernelInfoWithExecutionParametersWhenPa std::vector curbeParams; uint64_t tokenMask = 0; uint32_t firstSSHTokenIndex = 0; - MockKernel::ReflectionSurfaceHelperPublic::getCurbeParams(curbeParams, tokenMask, firstSSHTokenIndex, info, pPlatform->getDevice(0)->getHardwareInfo()); + MockKernel::ReflectionSurfaceHelperPublic::getCurbeParams(curbeParams, tokenMask, firstSSHTokenIndex, info, pPlatform->getClDevice(0)->getHardwareInfo()); EXPECT_LE(supportedExecutionParamTypes.size(), curbeParams.size()); @@ -1318,12 +1318,12 @@ TEST_P(ReflectionSurfaceHelperSetKernelDataTest, setKernelData) { size_t maxConstantBufferSize = 32; size_t samplerCount = 1; - size_t samplerHeapSize = alignUp(info.getSamplerStateArraySize(pPlatform->getDevice(0)->getHardwareInfo()), Sampler::samplerStateArrayAlignment) + info.getBorderColorStateSize(); + size_t samplerHeapSize = alignUp(info.getSamplerStateArraySize(pPlatform->getClDevice(0)->getHardwareInfo()), Sampler::samplerStateArrayAlignment) + info.getBorderColorStateSize(); uint32_t offsetInKernelDataMemory = 12; uint32_t offset = MockKernel::ReflectionSurfaceHelperPublic::setKernelData(kernelDataMemory.get(), offsetInKernelDataMemory, curbeParams, tokenMask, maxConstantBufferSize, samplerCount, - info, pPlatform->getDevice(0)->getHardwareInfo()); + info, pPlatform->getClDevice(0)->getHardwareInfo()); IGIL_KernelData *kernelData = reinterpret_cast(kernelDataMemory.get() + offsetInKernelDataMemory); @@ -1373,12 +1373,12 @@ TEST_F(ReflectionSurfaceHelperSetKernelDataTest, nullExecutionEnvironment) { size_t maxConstantBufferSize = 32; size_t samplerCount = 1; - size_t samplerHeapSize = alignUp(info.getSamplerStateArraySize(pPlatform->getDevice(0)->getHardwareInfo()), Sampler::samplerStateArrayAlignment) + info.getBorderColorStateSize(); + size_t samplerHeapSize = alignUp(info.getSamplerStateArraySize(pPlatform->getClDevice(0)->getHardwareInfo()), Sampler::samplerStateArrayAlignment) + info.getBorderColorStateSize(); uint32_t offsetInKernelDataMemory = 0; uint32_t offset = MockKernel::ReflectionSurfaceHelperPublic::setKernelData(kernelDataMemory.get(), offsetInKernelDataMemory, curbeParams, tokenMask, maxConstantBufferSize, samplerCount, - info, pPlatform->getDevice(0)->getHardwareInfo()); + info, pPlatform->getClDevice(0)->getHardwareInfo()); IGIL_KernelData *kernelData = reinterpret_cast(kernelDataMemory.get() + offsetInKernelDataMemory); @@ -1403,12 +1403,12 @@ TEST_F(ReflectionSurfaceHelperSetKernelDataTest, nullThreadPayload) { size_t maxConstantBufferSize = 32; size_t samplerCount = 1; - size_t samplerHeapSize = alignUp(info.getSamplerStateArraySize(pPlatform->getDevice(0)->getHardwareInfo()), Sampler::samplerStateArrayAlignment) + info.getBorderColorStateSize(); + size_t samplerHeapSize = alignUp(info.getSamplerStateArraySize(pPlatform->getClDevice(0)->getHardwareInfo()), Sampler::samplerStateArrayAlignment) + info.getBorderColorStateSize(); uint32_t offsetInKernelDataMemory = 0; uint32_t offset = MockKernel::ReflectionSurfaceHelperPublic::setKernelData(kernelDataMemory.get(), offsetInKernelDataMemory, curbeParams, tokenMask, maxConstantBufferSize, samplerCount, - info, pPlatform->getDevice(0)->getHardwareInfo()); + info, pPlatform->getClDevice(0)->getHardwareInfo()); IGIL_KernelData *kernelData = reinterpret_cast(kernelDataMemory.get() + offsetInKernelDataMemory); @@ -1432,12 +1432,12 @@ TEST_F(ReflectionSurfaceHelperSetKernelDataTest, nullPrivateSurface) { size_t maxConstantBufferSize = 32; size_t samplerCount = 1; - size_t samplerHeapSize = alignUp(info.getSamplerStateArraySize(pPlatform->getDevice(0)->getHardwareInfo()), Sampler::samplerStateArrayAlignment) + info.getBorderColorStateSize(); + size_t samplerHeapSize = alignUp(info.getSamplerStateArraySize(pPlatform->getClDevice(0)->getHardwareInfo()), Sampler::samplerStateArrayAlignment) + info.getBorderColorStateSize(); uint32_t offsetInKernelDataMemory = 0; uint32_t offset = MockKernel::ReflectionSurfaceHelperPublic::setKernelData(kernelDataMemory.get(), offsetInKernelDataMemory, curbeParams, tokenMask, maxConstantBufferSize, samplerCount, - info, pPlatform->getDevice(0)->getHardwareInfo()); + info, pPlatform->getClDevice(0)->getHardwareInfo()); IGIL_KernelData *kernelData = reinterpret_cast(kernelDataMemory.get() + offsetInKernelDataMemory); @@ -1461,12 +1461,12 @@ TEST_F(ReflectionSurfaceHelperSetKernelDataTest, nullSamplerState) { size_t maxConstantBufferSize = 32; size_t samplerCount = 1; - size_t samplerHeapSize = alignUp(info.getSamplerStateArraySize(pPlatform->getDevice(0)->getHardwareInfo()), Sampler::samplerStateArrayAlignment) + info.getBorderColorStateSize(); + size_t samplerHeapSize = alignUp(info.getSamplerStateArraySize(pPlatform->getClDevice(0)->getHardwareInfo()), Sampler::samplerStateArrayAlignment) + info.getBorderColorStateSize(); uint32_t offsetInKernelDataMemory = 0; uint32_t offset = MockKernel::ReflectionSurfaceHelperPublic::setKernelData(kernelDataMemory.get(), offsetInKernelDataMemory, curbeParams, tokenMask, maxConstantBufferSize, samplerCount, - info, pPlatform->getDevice(0)->getHardwareInfo()); + info, pPlatform->getClDevice(0)->getHardwareInfo()); IGIL_KernelData *kernelData = reinterpret_cast(kernelDataMemory.get() + offsetInKernelDataMemory); @@ -1495,7 +1495,7 @@ TEST_F(ReflectionSurfaceHelperSetKernelDataTest, setKernelDataWithDisabledConcur uint32_t offsetInKernelDataMemory = 0; MockKernel::ReflectionSurfaceHelperPublic::setKernelData(kernelDataMemory.get(), offsetInKernelDataMemory, curbeParams, tokenMask, maxConstantBufferSize, samplerCount, - info, pPlatform->getDevice(0)->getHardwareInfo()); + info, pPlatform->getClDevice(0)->getHardwareInfo()); IGIL_KernelData *kernelData = reinterpret_cast(kernelDataMemory.get() + offsetInKernelDataMemory); EXPECT_EQ(0u, kernelData->m_CanRunConcurently); @@ -1508,7 +1508,7 @@ TEST_F(ReflectionSurfaceHelperFixture, setKernelAddressDataWithNullBindingTable) std::unique_ptr kernelDataMemory(new char[200]); IGIL_KernelAddressData *kernalAddressData = reinterpret_cast(kernelDataMemory.get()); - MockKernel::ReflectionSurfaceHelperPublic::setKernelAddressData(kernelDataMemory.get(), 0, 1, 2, 3, 4, 5, 6, info, pPlatform->getDevice(0)->getHardwareInfo()); + MockKernel::ReflectionSurfaceHelperPublic::setKernelAddressData(kernelDataMemory.get(), 0, 1, 2, 3, 4, 5, 6, info, pPlatform->getClDevice(0)->getHardwareInfo()); EXPECT_EQ(1u, kernalAddressData->m_KernelDataOffset); EXPECT_EQ(2u, kernalAddressData->m_SamplerHeapOffset); @@ -1529,7 +1529,7 @@ TEST_F(ReflectionSurfaceHelperFixture, setKernelAddressDataWithSetBindingTable) std::unique_ptr kernelDataMemory(new char[200]); IGIL_KernelAddressData *kernalAddressData = reinterpret_cast(kernelDataMemory.get()); - MockKernel::ReflectionSurfaceHelperPublic::setKernelAddressData(kernelDataMemory.get(), 0, 1, 2, 3, 4, 5, 6, info, pPlatform->getDevice(0)->getHardwareInfo()); + MockKernel::ReflectionSurfaceHelperPublic::setKernelAddressData(kernelDataMemory.get(), 0, 1, 2, 3, 4, 5, 6, info, pPlatform->getClDevice(0)->getHardwareInfo()); EXPECT_EQ(1u, kernalAddressData->m_KernelDataOffset); EXPECT_EQ(2u, kernalAddressData->m_SamplerHeapOffset); diff --git a/opencl/test/unit_test/os_interface/hw_info_config_tests.cpp b/opencl/test/unit_test/os_interface/hw_info_config_tests.cpp index 6b0c5b604f..4d8a0c1735 100644 --- a/opencl/test/unit_test/os_interface/hw_info_config_tests.cpp +++ b/opencl/test/unit_test/os_interface/hw_info_config_tests.cpp @@ -9,13 +9,15 @@ #include "shared/source/helpers/hw_helper.h" +#include "opencl/source/device/cl_device.h" + using namespace NEO; using namespace std; void HwInfoConfigTest::SetUp() { PlatformFixture::SetUp(); - pInHwInfo = pPlatform->getDevice(0)->getHardwareInfo(); + pInHwInfo = pPlatform->getClDevice(0)->getHardwareInfo(); testPlatform = &pInHwInfo.platform; testSkuTable = &pInHwInfo.featureTable; diff --git a/opencl/test/unit_test/platform/platform_tests.cpp b/opencl/test/unit_test/platform/platform_tests.cpp index e93818c283..432b658c6f 100644 --- a/opencl/test/unit_test/platform/platform_tests.cpp +++ b/opencl/test/unit_test/platform/platform_tests.cpp @@ -75,16 +75,13 @@ TEST_F(PlatformTest, WhenGetNumDevicesIsCalledThenExpectedValuesAreReturned) { } TEST_F(PlatformTest, WhenGetDeviceIsCalledThenExpectedValuesAreReturned) { - EXPECT_EQ(nullptr, pPlatform->getDevice(0)); EXPECT_EQ(nullptr, pPlatform->getClDevice(0)); pPlatform->initializeWithNewDevices(); - EXPECT_NE(nullptr, pPlatform->getDevice(0)); EXPECT_NE(nullptr, pPlatform->getClDevice(0)); auto numDevices = pPlatform->getNumDevices(); - EXPECT_EQ(nullptr, pPlatform->getDevice(numDevices)); EXPECT_EQ(nullptr, pPlatform->getClDevice(numDevices)); } diff --git a/opencl/test/unit_test/program/program_data_tests.cpp b/opencl/test/unit_test/program/program_data_tests.cpp index 6a7b59f4c1..6dd33631f6 100644 --- a/opencl/test/unit_test/program/program_data_tests.cpp +++ b/opencl/test/unit_test/program/program_data_tests.cpp @@ -305,7 +305,7 @@ TEST_F(ProgramDataTest, givenConstantAllocationThatIsInUseByGpuWhenProgramIsBein buildAndDecodeProgramPatchList(); - auto &csr = *pPlatform->getDevice(0)->getDefaultEngine().commandStreamReceiver; + auto &csr = *pPlatform->getClDevice(0)->getDefaultEngine().commandStreamReceiver; auto tagAddress = csr.getTagAddress(); auto constantSurface = pProgram->getConstantSurface(); constantSurface->updateTaskCount(*tagAddress + 1, csr.getOsContext().getContextId()); @@ -322,7 +322,7 @@ TEST_F(ProgramDataTest, givenGlobalAllocationThatIsInUseByGpuWhenProgramIsBeingD buildAndDecodeProgramPatchList(); - auto &csr = *pPlatform->getDevice(0)->getDefaultEngine().commandStreamReceiver; + auto &csr = *pPlatform->getClDevice(0)->getDefaultEngine().commandStreamReceiver; auto tagAddress = csr.getTagAddress(); auto globalSurface = pProgram->getGlobalSurface(); globalSurface->updateTaskCount(*tagAddress + 1, csr.getOsContext().getContextId()); diff --git a/opencl/test/unit_test/program/program_tests.cpp b/opencl/test/unit_test/program/program_tests.cpp index 478936a95a..09719b3071 100644 --- a/opencl/test/unit_test/program/program_tests.cpp +++ b/opencl/test/unit_test/program/program_tests.cpp @@ -709,7 +709,7 @@ TEST_P(ProgramFromSourceTest, GivenSpecificParamatersWhenBuildingProgramThenSucc EXPECT_EQ(CL_BUILD_PROGRAM_FAILURE, retVal); // fail build - linked code is corrupted and cannot be postprocessed - auto p3 = std::make_unique(*pPlatform->getDevice(0)->getExecutionEnvironment()); + auto p3 = std::make_unique(*executionEnvironment); p3->setDevice(&device->getDevice()); std::string testFile; size_t sourceSize; @@ -1173,8 +1173,8 @@ TEST_P(ProgramFromSourceTest, GivenSpecificParamatersWhenLinkingProgramThenSucce EXPECT_EQ(CL_LINK_PROGRAM_FAILURE, retVal); // fail linking - linked code is corrupted and cannot be postprocessed - auto p2 = std::make_unique(*pPlatform->getDevice(0)->getExecutionEnvironment()); - ClDevice *device = pPlatform->getClDevice(0); + auto device = static_cast(usedDevice); + auto p2 = std::make_unique(*device->getExecutionEnvironment()); p2->setDevice(&device->getDevice()); retVal = p2->link(0, nullptr, nullptr, 1, &program, nullptr, nullptr); EXPECT_EQ(CL_INVALID_BINARY, retVal); diff --git a/opencl/test/unit_test/program/program_with_block_kernels_tests.cpp b/opencl/test/unit_test/program/program_with_block_kernels_tests.cpp index 1ba4305c6f..aab1272dfd 100644 --- a/opencl/test/unit_test/program/program_with_block_kernels_tests.cpp +++ b/opencl/test/unit_test/program/program_with_block_kernels_tests.cpp @@ -99,7 +99,7 @@ TEST_F(ProgramWithBlockKernelsTest, GivenKernelWithBlockKernelsWhenProgramIsLink const char *buildOptions = "-cl-std=CL2.0"; overwriteBuiltInBinaryName( - pPlatform->getDevice(0), + &pPlatform->getClDevice(0)->getDevice(), "simple_block_kernel", true); ASSERT_NE(nullptr, pProgram); diff --git a/shared/test/unit_test/gen11/test_preamble_gen11.cpp b/shared/test/unit_test/gen11/test_preamble_gen11.cpp index 81b7b6753f..4eb99c5737 100644 --- a/shared/test/unit_test/gen11/test_preamble_gen11.cpp +++ b/shared/test/unit_test/gen11/test_preamble_gen11.cpp @@ -58,7 +58,7 @@ GEN11TEST_F(Gen11PreambleVfeState, WaOff) { typedef typename ICLFamily::PIPE_CONTROL PIPE_CONTROL; testWaTable->waSendMIFLUSHBeforeVFE = 0; LinearStream &cs = linearStream; - PreambleHelper::programVFEState(&linearStream, pPlatform->getDevice(0)->getHardwareInfo(), 0, 0, 168u, aub_stream::EngineType::ENGINE_RCS); + PreambleHelper::programVFEState(&linearStream, pPlatform->getClDevice(0)->getHardwareInfo(), 0, 0, 168u, aub_stream::EngineType::ENGINE_RCS); parseCommands(cs); @@ -76,7 +76,7 @@ GEN11TEST_F(Gen11PreambleVfeState, WaOn) { typedef typename ICLFamily::PIPE_CONTROL PIPE_CONTROL; testWaTable->waSendMIFLUSHBeforeVFE = 1; LinearStream &cs = linearStream; - PreambleHelper::programVFEState(&linearStream, pPlatform->getDevice(0)->getHardwareInfo(), 0, 0, 168u, aub_stream::EngineType::ENGINE_RCS); + PreambleHelper::programVFEState(&linearStream, pPlatform->getClDevice(0)->getHardwareInfo(), 0, 0, 168u, aub_stream::EngineType::ENGINE_RCS); parseCommands(cs); diff --git a/shared/test/unit_test/gen12lp/test_preamble_gen12lp.cpp b/shared/test/unit_test/gen12lp/test_preamble_gen12lp.cpp index 70d0106287..de018744d0 100644 --- a/shared/test/unit_test/gen12lp/test_preamble_gen12lp.cpp +++ b/shared/test/unit_test/gen12lp/test_preamble_gen12lp.cpp @@ -60,7 +60,7 @@ TGLLPTEST_F(Gen12LpPreambleVfeState, WaOff) { typedef typename FamilyType::PIPE_CONTROL PIPE_CONTROL; testWaTable->waSendMIFLUSHBeforeVFE = 0; LinearStream &cs = linearStream; - PreambleHelper::programVFEState(&linearStream, pPlatform->getDevice(0)->getHardwareInfo(), 0, 0, 672u, aub_stream::EngineType::ENGINE_RCS); + PreambleHelper::programVFEState(&linearStream, pPlatform->getClDevice(0)->getHardwareInfo(), 0, 0, 672u, aub_stream::EngineType::ENGINE_RCS); parseCommands(cs); @@ -79,7 +79,7 @@ TGLLPTEST_F(Gen12LpPreambleVfeState, givenCcsEngineWhenWaIsSetThenAppropriatePip testWaTable->waSendMIFLUSHBeforeVFE = 1; LinearStream &cs = linearStream; - PreambleHelper::programVFEState(&linearStream, pPlatform->getDevice(0)->getHardwareInfo(), 0, 0, 672u, aub_stream::EngineType::ENGINE_CCS); + PreambleHelper::programVFEState(&linearStream, pPlatform->getClDevice(0)->getHardwareInfo(), 0, 0, 672u, aub_stream::EngineType::ENGINE_CCS); parseCommands(cs); @@ -98,7 +98,7 @@ TGLLPTEST_F(Gen12LpPreambleVfeState, givenRcsEngineWhenWaIsSetThenAppropriatePip testWaTable->waSendMIFLUSHBeforeVFE = 1; LinearStream &cs = linearStream; - PreambleHelper::programVFEState(&linearStream, pPlatform->getDevice(0)->getHardwareInfo(), 0, 0, 672u, aub_stream::EngineType::ENGINE_RCS); + PreambleHelper::programVFEState(&linearStream, pPlatform->getClDevice(0)->getHardwareInfo(), 0, 0, 672u, aub_stream::EngineType::ENGINE_RCS); parseCommands(cs); @@ -125,7 +125,7 @@ TGLLPTEST_F(Gen12LpPreambleVfeState, givenCfeFusedEuDispatchFlagsWhenprogramAddi using MEDIA_VFE_STATE = typename FamilyType::MEDIA_VFE_STATE; DebugManagerStateRestore restorer; - auto pHwInfo = pPlatform->getDevice(0)->getRootDeviceEnvironment().getMutableHardwareInfo(); + auto pHwInfo = pPlatform->getClDevice(0)->getRootDeviceEnvironment().getMutableHardwareInfo(); auto pMediaVfeState = reinterpret_cast(linearStream.getSpace(sizeof(MEDIA_VFE_STATE))); *pMediaVfeState = FamilyType::cmdInitMediaVfeState; auto &waTable = pHwInfo->workaroundTable; diff --git a/shared/test/unit_test/gen9/skl/test_preamble_skl.cpp b/shared/test/unit_test/gen9/skl/test_preamble_skl.cpp index 0af8a2e6c5..d525c93761 100644 --- a/shared/test/unit_test/gen9/skl/test_preamble_skl.cpp +++ b/shared/test/unit_test/gen9/skl/test_preamble_skl.cpp @@ -108,7 +108,7 @@ GEN9TEST_F(PreambleVfeState, WaOff) { typedef typename FamilyType::PIPE_CONTROL PIPE_CONTROL; testWaTable->waSendMIFLUSHBeforeVFE = 0; LinearStream &cs = linearStream; - PreambleHelper::programVFEState(&linearStream, pPlatform->getDevice(0)->getHardwareInfo(), 0, 0, 168u, aub_stream::EngineType::ENGINE_RCS); + PreambleHelper::programVFEState(&linearStream, pPlatform->getClDevice(0)->getHardwareInfo(), 0, 0, 168u, aub_stream::EngineType::ENGINE_RCS); parseCommands(cs); @@ -126,7 +126,7 @@ GEN9TEST_F(PreambleVfeState, WaOn) { typedef typename FamilyType::PIPE_CONTROL PIPE_CONTROL; testWaTable->waSendMIFLUSHBeforeVFE = 1; LinearStream &cs = linearStream; - PreambleHelper::programVFEState(&linearStream, pPlatform->getDevice(0)->getHardwareInfo(), 0, 0, 168u, aub_stream::EngineType::ENGINE_RCS); + PreambleHelper::programVFEState(&linearStream, pPlatform->getClDevice(0)->getHardwareInfo(), 0, 0, 168u, aub_stream::EngineType::ENGINE_RCS); parseCommands(cs);