diff --git a/opencl/source/command_queue/command_queue.cpp b/opencl/source/command_queue/command_queue.cpp index 22163a5684..e61dd4effe 100644 --- a/opencl/source/command_queue/command_queue.cpp +++ b/opencl/source/command_queue/command_queue.cpp @@ -514,7 +514,7 @@ bool CommandQueue::setupDebugSurface(Kernel *kernel) { kernel->getKernelInfo().patchInfo.pAllocateSystemThreadSurface->Offset); void *addressToPatch = reinterpret_cast(debugSurface->getGpuAddress()); size_t sizeToPatch = debugSurface->getUnderlyingBufferSize(); - Buffer::setSurfaceState(device, surfaceState, sizeToPatch, addressToPatch, 0, debugSurface, 0, 0); + Buffer::setSurfaceState(&device->getDevice(), surfaceState, sizeToPatch, addressToPatch, 0, debugSurface, 0, 0); return true; } diff --git a/opencl/source/kernel/kernel.cpp b/opencl/source/kernel/kernel.cpp index 8b39275522..ff7e3ba5cb 100644 --- a/opencl/source/kernel/kernel.cpp +++ b/opencl/source/kernel/kernel.cpp @@ -179,7 +179,7 @@ void Kernel::patchWithImplicitSurface(void *ptrToPatchInCrossThreadData, Graphic auto surfaceState = ptrOffset(ssh, sshOffset); void *addressToPatch = reinterpret_cast(allocation.getGpuAddressToPatch()); size_t sizeToPatch = allocation.getUnderlyingBufferSize(); - Buffer::setSurfaceState(&getDevice(), surfaceState, sizeToPatch, addressToPatch, 0, &allocation, 0, 0); + Buffer::setSurfaceState(&getDevice().getDevice(), surfaceState, sizeToPatch, addressToPatch, 0, &allocation, 0, 0); } } @@ -311,7 +311,7 @@ cl_int Kernel::initialize() { if (requiresSshForBuffers()) { auto surfaceState = ptrOffset(reinterpret_cast(getSurfaceStateHeap()), patchInfo.pAllocateStatelessEventPoolSurface->SurfaceStateHeapOffset); - Buffer::setSurfaceState(&getDevice(), surfaceState, 0, nullptr, 0, nullptr, 0, 0); + Buffer::setSurfaceState(&getDevice().getDevice(), surfaceState, 0, nullptr, 0, nullptr, 0, 0); } } @@ -320,7 +320,7 @@ cl_int Kernel::initialize() { if (requiresSshForBuffers()) { auto surfaceState = ptrOffset(reinterpret_cast(getSurfaceStateHeap()), patchInfo.pAllocateStatelessDefaultDeviceQueueSurface->SurfaceStateHeapOffset); - Buffer::setSurfaceState(&getDevice(), surfaceState, 0, nullptr, 0, nullptr, 0, 0); + Buffer::setSurfaceState(&getDevice().getDevice(), surfaceState, 0, nullptr, 0, nullptr, 0, 0); } } if (kernelInfo.patchInfo.executionEnvironment) { @@ -895,7 +895,7 @@ cl_int Kernel::setArgSvm(uint32_t argIndex, size_t svmAllocSize, void *svmPtr, G if (requiresSshForBuffers()) { const auto &kernelArgInfo = kernelInfo.kernelArgInfo[argIndex]; auto surfaceState = ptrOffset(getSurfaceStateHeap(), kernelArgInfo.offsetHeap); - Buffer::setSurfaceState(&getDevice(), surfaceState, svmAllocSize + ptrDiff(svmPtr, ptrToPatch), ptrToPatch, 0, svmAlloc, svmFlags, 0); + Buffer::setSurfaceState(&getDevice().getDevice(), surfaceState, svmAllocSize + ptrDiff(svmPtr, ptrToPatch), ptrToPatch, 0, svmAlloc, svmFlags, 0); } if (!kernelArguments[argIndex].isPatched) { patchedArgumentsNum++; @@ -932,7 +932,7 @@ cl_int Kernel::setArgSvmAlloc(uint32_t argIndex, void *svmPtr, GraphicsAllocatio offset = ptrDiff(ptrToPatch, svmAlloc->getGpuAddressToPatch()); allocSize -= offset; } - Buffer::setSurfaceState(&getDevice(), surfaceState, allocSize, ptrToPatch, offset, svmAlloc, 0, 0); + Buffer::setSurfaceState(&getDevice().getDevice(), surfaceState, allocSize, ptrToPatch, offset, svmAlloc, 0, 0); } if (!kernelArguments[argIndex].isPatched) { @@ -1335,7 +1335,7 @@ cl_int Kernel::setArgBuffer(uint32_t argIndex, if (requiresSshForBuffers()) { auto surfaceState = ptrOffset(getSurfaceStateHeap(), kernelArgInfo.offsetHeap); - Buffer::setSurfaceState(&getDevice(), surfaceState, 0, nullptr, 0, nullptr, 0, 0); + Buffer::setSurfaceState(&getDevice().getDevice(), surfaceState, 0, nullptr, 0, nullptr, 0, 0); } return CL_SUCCESS; @@ -1382,7 +1382,7 @@ cl_int Kernel::setArgPipe(uint32_t argIndex, if (requiresSshForBuffers()) { auto surfaceState = ptrOffset(getSurfaceStateHeap(), kernelArgInfo.offsetHeap); - Buffer::setSurfaceState(&getDevice(), surfaceState, + Buffer::setSurfaceState(&getDevice().getDevice(), surfaceState, pipe->getSize(), pipe->getCpuAddress(), 0, pipe->getGraphicsAllocation(), 0, 0); } @@ -2233,7 +2233,7 @@ void Kernel::patchDefaultDeviceQueue(DeviceQueue *devQueue) { if (requiresSshForBuffers()) { auto surfaceState = ptrOffset(reinterpret_cast(getSurfaceStateHeap()), patchInfo.pAllocateStatelessDefaultDeviceQueueSurface->SurfaceStateHeapOffset); - Buffer::setSurfaceState(&getDevice(), surfaceState, devQueue->getQueueBuffer()->getUnderlyingBufferSize(), + Buffer::setSurfaceState(&getDevice().getDevice(), surfaceState, devQueue->getQueueBuffer()->getUnderlyingBufferSize(), (void *)devQueue->getQueueBuffer()->getGpuAddress(), 0, devQueue->getQueueBuffer(), 0, 0); } } @@ -2254,7 +2254,7 @@ void Kernel::patchEventPool(DeviceQueue *devQueue) { if (requiresSshForBuffers()) { auto surfaceState = ptrOffset(reinterpret_cast(getSurfaceStateHeap()), patchInfo.pAllocateStatelessEventPoolSurface->SurfaceStateHeapOffset); - Buffer::setSurfaceState(&getDevice(), surfaceState, devQueue->getEventPoolBuffer()->getUnderlyingBufferSize(), + Buffer::setSurfaceState(&getDevice().getDevice(), surfaceState, devQueue->getEventPoolBuffer()->getUnderlyingBufferSize(), (void *)devQueue->getEventPoolBuffer()->getGpuAddress(), 0, devQueue->getEventPoolBuffer(), 0, 0); } } @@ -2288,7 +2288,7 @@ void Kernel::patchSyncBuffer(Device &device, GraphicsAllocation *gfxAllocation, patchInfo.pAllocateSyncBuffer->SurfaceStateHeapOffset); auto addressToPatch = gfxAllocation->getUnderlyingBuffer(); auto sizeToPatch = gfxAllocation->getUnderlyingBufferSize(); - Buffer::setSurfaceState(device.getSpecializedDevice(), surfaceState, sizeToPatch, addressToPatch, 0, gfxAllocation, 0, 0); + Buffer::setSurfaceState(&device, surfaceState, sizeToPatch, addressToPatch, 0, gfxAllocation, 0, 0); } } diff --git a/opencl/source/mem_obj/buffer.cpp b/opencl/source/mem_obj/buffer.cpp index bf12fcc0a4..4f2b2db1a1 100644 --- a/opencl/source/mem_obj/buffer.cpp +++ b/opencl/source/mem_obj/buffer.cpp @@ -562,7 +562,7 @@ Buffer *Buffer::createBufferHw(Context *context, return pBuffer; } -Buffer *Buffer::createBufferHwFromDevice(const ClDevice *device, +Buffer *Buffer::createBufferHwFromDevice(const Device *device, cl_mem_flags flags, cl_mem_flags_intel flagsIntel, size_t size, @@ -621,7 +621,7 @@ bool Buffer::isCompressed() const { return false; } -void Buffer::setSurfaceState(const ClDevice *device, +void Buffer::setSurfaceState(const Device *device, void *surfaceState, size_t svmSize, void *svmPtr, diff --git a/opencl/source/mem_obj/buffer.h b/opencl/source/mem_obj/buffer.h index 0392523b1e..58cd143e14 100644 --- a/opencl/source/mem_obj/buffer.h +++ b/opencl/source/mem_obj/buffer.h @@ -17,6 +17,7 @@ #include "memory_properties_flags.h" namespace NEO { +class Device; class Buffer; class ClDevice; class MemoryManager; @@ -88,7 +89,7 @@ class Buffer : public MemObj { bool isHostPtrSVM, bool isImageRedescribed); - static Buffer *createBufferHwFromDevice(const ClDevice *device, + static Buffer *createBufferHwFromDevice(const Device *device, cl_mem_flags flags, cl_mem_flags_intel flagsIntel, size_t size, @@ -105,7 +106,7 @@ class Buffer : public MemObj { const cl_buffer_region *region, cl_int &errcodeRet); - static void setSurfaceState(const ClDevice *device, + static void setSurfaceState(const Device *device, void *surfaceState, size_t svmSize, void *svmPtr, diff --git a/opencl/source/program/printf_handler.cpp b/opencl/source/program/printf_handler.cpp index 3063a8f86d..724559fb8f 100644 --- a/opencl/source/program/printf_handler.cpp +++ b/opencl/source/program/printf_handler.cpp @@ -55,7 +55,7 @@ void PrintfHandler::prepareDispatch(const MultiDispatchInfo &multiDispatchInfo) kernel->getKernelInfo().patchInfo.pAllocateStatelessPrintfSurface->SurfaceStateHeapOffset); void *addressToPatch = printfSurface->getUnderlyingBuffer(); size_t sizeToPatch = printfSurface->getUnderlyingBufferSize(); - Buffer::setSurfaceState(&device, surfaceState, sizeToPatch, addressToPatch, 0, printfSurface, 0, 0); + Buffer::setSurfaceState(&device.getDevice(), surfaceState, sizeToPatch, addressToPatch, 0, printfSurface, 0, 0); } } diff --git a/opencl/test/unit_test/kernel/kernel_arg_svm_tests.cpp b/opencl/test/unit_test/kernel/kernel_arg_svm_tests.cpp index 485dd4a405..8c79b8e5ae 100644 --- a/opencl/test/unit_test/kernel/kernel_arg_svm_tests.cpp +++ b/opencl/test/unit_test/kernel/kernel_arg_svm_tests.cpp @@ -270,7 +270,7 @@ HWTEST_F(KernelArgSvmTest, PatchWithImplicitSurface) { { void *addressToPatch = svmAlloc.getUnderlyingBuffer(); size_t sizeToPatch = svmAlloc.getUnderlyingBufferSize(); - Buffer::setSurfaceState(pClDevice, &expectedSurfaceState, sizeToPatch, + Buffer::setSurfaceState(pDevice, &expectedSurfaceState, sizeToPatch, addressToPatch, 0, &svmAlloc, 0, 0); } @@ -377,7 +377,7 @@ HWTEST_TYPED_TEST(KernelArgSvmTestTyped, GivenBufferKernelArgWhenBufferOffsetIsN using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE; constexpr size_t rendSurfSize = sizeof(RENDER_SURFACE_STATE); - auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(*platformDevices)); + auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(*platformDevices)); uint32_t svmSize = MemoryConstants::pageSize; char *svmPtr = reinterpret_cast(alignedMalloc(svmSize, MemoryConstants::pageSize)); diff --git a/opencl/test/unit_test/mem_obj/buffer_tests.cpp b/opencl/test/unit_test/mem_obj/buffer_tests.cpp index c57b9b04e2..b36a02b84d 100644 --- a/opencl/test/unit_test/mem_obj/buffer_tests.cpp +++ b/opencl/test/unit_test/mem_obj/buffer_tests.cpp @@ -1857,11 +1857,11 @@ TEST(ResidencyTests, whenBuffersIsCreatedWithMakeResidentFlagThenItSuccessfulyCr class BufferTests : public ::testing::Test { protected: void SetUp() override { - device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(*platformDevices)); + device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(*platformDevices)); } void TearDown() override { } - std::unique_ptr device; + std::unique_ptr device; }; typedef BufferTests BufferSetSurfaceTests; diff --git a/opencl/test/unit_test/mocks/mock_buffer.h b/opencl/test/unit_test/mocks/mock_buffer.h index 019e3cce96..955e3c95d2 100644 --- a/opencl/test/unit_test/mocks/mock_buffer.h +++ b/opencl/test/unit_test/mocks/mock_buffer.h @@ -24,7 +24,7 @@ class MockBufferStorage { } char data[128]; MockGraphicsAllocation mockGfxAllocation; - std::unique_ptr device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); + std::unique_ptr device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(nullptr)); }; class MockBuffer : public MockBufferStorage, public Buffer {