From 97119f5f3ed8b8d627fca6f66c38fcdbed44446d Mon Sep 17 00:00:00 2001 From: Mateusz Jablonski Date: Mon, 16 Nov 2020 12:08:30 +0100 Subject: [PATCH] Store ClDevice in DispatchInfo Related-To: NEO-5001 Signed-off-by: Mateusz Jablonski --- opencl/source/api/api.cpp | 7 +- .../built_ins/aux_translation_builtin.h | 2 +- opencl/source/built_ins/built_ins.inl | 4 +- .../built_ins/builtins_dispatch_builder.cpp | 163 +++++++++--------- .../built_ins/builtins_dispatch_builder.h | 5 +- .../source/built_ins/populate_built_ins.inl | 6 +- .../source/built_ins/vme_dispatch_builder.h | 6 +- opencl/source/command_queue/enqueue_common.h | 5 +- .../source/command_queue/local_work_size.cpp | 5 +- opencl/source/device_queue/device_queue.cpp | 4 + opencl/source/device_queue/device_queue.h | 1 + opencl/source/helpers/dispatch_info.h | 13 +- opencl/source/helpers/dispatch_info_builder.h | 12 +- opencl/source/kernel/kernel.cpp | 4 +- opencl/source/kernel/kernel.h | 2 +- opencl/source/program/kernel_info.cpp | 9 +- ..._suggested_local_work_size_intel_tests.inl | 4 +- .../unit_test/built_ins/built_in_tests.cpp | 20 +-- .../command_queue/command_queue_fixture.cpp | 3 +- .../command_queue/command_queue_fixture.h | 3 +- .../command_queue/command_queue_hw_tests.cpp | 15 +- .../command_queue/command_queue_tests.cpp | 4 +- .../command_queue/dispatch_walker_tests.cpp | 64 +++---- .../enqueue_command_without_kernel_tests.cpp | 2 +- .../enqueue_copy_buffer_to_image_tests.cpp | 2 +- .../enqueue_copy_image_tests.cpp | 2 +- .../enqueue_copy_image_to_buffer_tests.cpp | 2 +- .../command_queue/enqueue_handler_tests.cpp | 18 +- .../command_queue/enqueue_kernel_1_tests.cpp | 6 +- .../enqueue_read_image_tests.cpp | 4 +- .../enqueue_svm_mem_copy_tests.cpp | 6 +- .../enqueue_svm_mem_fill_tests.cpp | 6 +- .../enqueue_write_image_tests.cpp | 4 +- .../command_queue/local_work_size_tests.cpp | 2 + .../multi_dispatch_info_tests.cpp | 2 +- .../aub_command_stream_receiver_1_tests.cpp | 24 +-- .../tbx_command_stream_tests.cpp | 6 +- .../driver_diagnostics_enqueue_tests.cpp | 2 +- .../context/driver_diagnostics_tests.cpp | 18 +- opencl/test/unit_test/event/event_tests.cpp | 2 +- .../enqueue_execution_model_kernel_tests.cpp | 14 +- .../parent_kernel_dispatch_tests.cpp | 26 +-- .../submit_blocked_parent_kernel_tests.cpp | 2 +- .../fixtures/cl_preemption_fixture.cpp | 2 +- .../fixtures/execution_model_fixture.h | 2 - .../helpers/dispatch_info_builder_tests.cpp | 53 +++--- .../unit_test/helpers/dispatch_info_tests.cpp | 14 +- .../helpers/timestamp_packet_tests.cpp | 14 +- .../kernel_reflection_surface_tests.cpp | 4 +- opencl/test/unit_test/kernel/kernel_tests.cpp | 6 +- .../memory_manager/memory_manager_tests.cpp | 6 +- .../mock_builtin_dispatch_info_builder.h | 4 +- opencl/test/unit_test/mocks/mock_mdi.h | 8 +- .../unit_test/preemption/preemption_tests.cpp | 2 +- .../program/printf_handler_tests.cpp | 22 +-- .../unit_test/utilities/file_logger_tests.cpp | 4 +- 56 files changed, 335 insertions(+), 317 deletions(-) diff --git a/opencl/source/api/api.cpp b/opencl/source/api/api.cpp index 87b50b727f..2584a49593 100644 --- a/opencl/source/api/api.cpp +++ b/opencl/source/api/api.cpp @@ -5493,7 +5493,9 @@ cl_int CL_API_CALL clGetKernelSuggestedLocalWorkSizeINTEL(cl_command_queue comma "globalWorkSize", NEO::FileLoggerInstance().getSizes(globalWorkSize, workDim, true), "suggestedLocalWorkSize", suggestedLocalWorkSize); - retVal = validateObjects(commandQueue, kernel); + Kernel *pKernel = nullptr; + CommandQueue *pCommandQueue = nullptr; + retVal = validateObjects(WithCastToInternal(commandQueue, &pCommandQueue), WithCastToInternal(kernel, &pKernel)); if (CL_SUCCESS != retVal) { return retVal; @@ -5509,7 +5511,6 @@ cl_int CL_API_CALL clGetKernelSuggestedLocalWorkSizeINTEL(cl_command_queue comma return retVal; } - auto pKernel = castToObjectOrAbort(kernel); if (!pKernel->isPatched()) { retVal = CL_INVALID_KERNEL; return retVal; @@ -5520,7 +5521,7 @@ cl_int CL_API_CALL clGetKernelSuggestedLocalWorkSizeINTEL(cl_command_queue comma return retVal; } - pKernel->getSuggestedLocalWorkSize(workDim, globalWorkSize, globalWorkOffset, suggestedLocalWorkSize); + pKernel->getSuggestedLocalWorkSize(workDim, globalWorkSize, globalWorkOffset, suggestedLocalWorkSize, pCommandQueue->getClDevice()); return retVal; } diff --git a/opencl/source/built_ins/aux_translation_builtin.h b/opencl/source/built_ins/aux_translation_builtin.h index 49300719f3..9c039a8ddb 100644 --- a/opencl/source/built_ins/aux_translation_builtin.h +++ b/opencl/source/built_ins/aux_translation_builtin.h @@ -29,7 +29,7 @@ class BuiltInOp : public BuiltinDispatchInfoBuilder multiDispatchInfo.setBuiltinOpParams(operationParams); for (auto &memObj : *multiDispatchInfo.getMemObjsForAuxTranslation()) { - DispatchInfoBuilder builder; + DispatchInfoBuilder builder(clDevice); size_t allocationSize = alignUp(memObj->getSize(), 512); UNRECOVERABLE_IF(builder.getMaxNumDispatches() != 1); diff --git a/opencl/source/built_ins/built_ins.inl b/opencl/source/built_ins/built_ins.inl index e83b721413..c11a6042c3 100644 --- a/opencl/source/built_ins/built_ins.inl +++ b/opencl/source/built_ins/built_ins.inl @@ -11,8 +11,8 @@ #include "opencl/source/mem_obj/buffer.h" namespace NEO { -BuiltInOp::BuiltInOp(BuiltIns &kernelsLib, ClDevice &device) : BuiltinDispatchInfoBuilder(kernelsLib) { - BuiltinDispatchInfoBuilder::populate(device, EBuiltInOps::AuxTranslation, "", "fullCopy", baseKernel); +BuiltInOp::BuiltInOp(BuiltIns &kernelsLib, ClDevice &device) : BuiltinDispatchInfoBuilder(kernelsLib, device) { + BuiltinDispatchInfoBuilder::populate(EBuiltInOps::AuxTranslation, "", "fullCopy", baseKernel); resizeKernelInstances(5); } diff --git a/opencl/source/built_ins/builtins_dispatch_builder.cpp b/opencl/source/built_ins/builtins_dispatch_builder.cpp index 29b1c06b05..98b5f96903 100644 --- a/opencl/source/built_ins/builtins_dispatch_builder.cpp +++ b/opencl/source/built_ins/builtins_dispatch_builder.cpp @@ -34,17 +34,10 @@ template <> class BuiltInOp : public BuiltinDispatchInfoBuilder { public: BuiltInOp(BuiltIns &kernelsLib, ClDevice &device) - : BuiltinDispatchInfoBuilder(kernelsLib) { - populate(device, - EBuiltInOps::CopyBufferToBuffer, - "", - "CopyBufferToBufferLeftLeftover", kernLeftLeftover, - "CopyBufferToBufferMiddle", kernMiddle, - "CopyBufferToBufferRightLeftover", kernRightLeftover); - } + : BuiltInOp(kernelsLib, device, true) {} template bool buildDispatchInfosTyped(MultiDispatchInfo &multiDispatchInfo) const { - DispatchInfoBuilder kernelSplit1DBuilder; + DispatchInfoBuilder kernelSplit1DBuilder(clDevice); auto &operationParams = multiDispatchInfo.peekBuiltinOpParams(); uintptr_t start = reinterpret_cast(operationParams.dstPtr) + operationParams.dstOffset.x; @@ -120,8 +113,15 @@ class BuiltInOp : public BuiltinDispatchInfoBui Kernel *kernLeftLeftover = nullptr; Kernel *kernMiddle = nullptr; Kernel *kernRightLeftover = nullptr; - BuiltInOp(BuiltIns &kernelsLib) - : BuiltinDispatchInfoBuilder(kernelsLib) { + BuiltInOp(BuiltIns &kernelsLib, ClDevice &device, bool populateKernels) + : BuiltinDispatchInfoBuilder(kernelsLib, device) { + if (populateKernels) { + populate(EBuiltInOps::CopyBufferToBuffer, + "", + "CopyBufferToBufferLeftLeftover", kernLeftLeftover, + "CopyBufferToBufferMiddle", kernMiddle, + "CopyBufferToBufferRightLeftover", kernRightLeftover); + } } }; @@ -129,9 +129,8 @@ template <> class BuiltInOp : public BuiltInOp { public: BuiltInOp(BuiltIns &kernelsLib, ClDevice &device) - : BuiltInOp(kernelsLib) { - populate(device, - EBuiltInOps::CopyBufferToBufferStateless, + : BuiltInOp(kernelsLib, device, false) { + populate(EBuiltInOps::CopyBufferToBufferStateless, CompilerOptions::greaterThan4gbBuffersRequired, "CopyBufferToBufferLeftLeftover", kernLeftLeftover, "CopyBufferToBufferMiddle", kernMiddle, @@ -147,18 +146,11 @@ template <> class BuiltInOp : public BuiltinDispatchInfoBuilder { public: BuiltInOp(BuiltIns &kernelsLib, ClDevice &device) - : BuiltinDispatchInfoBuilder(kernelsLib), kernelBytes{nullptr} { - populate(device, - EBuiltInOps::CopyBufferRect, - "", - "CopyBufferRectBytes2d", kernelBytes[0], - "CopyBufferRectBytes2d", kernelBytes[1], - "CopyBufferRectBytes3d", kernelBytes[2]); - } + : BuiltInOp(kernelsLib, device, true) {} template bool buildDispatchInfosTyped(MultiDispatchInfo &multiDispatchInfo) const { - DispatchInfoBuilder kernelNoSplit3DBuilder; + DispatchInfoBuilder kernelNoSplit3DBuilder(clDevice); auto &operationParams = multiDispatchInfo.peekBuiltinOpParams(); size_t hostPtrSize = 0; @@ -244,17 +236,25 @@ class BuiltInOp : public BuiltinDispatchInfoBuilder } protected: - Kernel *kernelBytes[3]; - BuiltInOp(BuiltIns &kernelsLib) : BuiltinDispatchInfoBuilder(kernelsLib), kernelBytes{nullptr} {}; + Kernel *kernelBytes[3]{}; + BuiltInOp(BuiltIns &kernelsLib, ClDevice &device, bool populateKernels) + : BuiltinDispatchInfoBuilder(kernelsLib, device) { + if (populateKernels) { + populate(EBuiltInOps::CopyBufferRect, + "", + "CopyBufferRectBytes2d", kernelBytes[0], + "CopyBufferRectBytes2d", kernelBytes[1], + "CopyBufferRectBytes3d", kernelBytes[2]); + } + } }; template <> class BuiltInOp : public BuiltInOp { public: BuiltInOp(BuiltIns &kernelsLib, ClDevice &device) - : BuiltInOp(kernelsLib) { - populate(device, - EBuiltInOps::CopyBufferRectStateless, + : BuiltInOp(kernelsLib, device, false) { + populate(EBuiltInOps::CopyBufferRectStateless, CompilerOptions::greaterThan4gbBuffersRequired, "CopyBufferRectBytes2d", kernelBytes[0], "CopyBufferRectBytes2d", kernelBytes[1], @@ -269,18 +269,11 @@ template <> class BuiltInOp : public BuiltinDispatchInfoBuilder { public: BuiltInOp(BuiltIns &kernelsLib, ClDevice &device) - : BuiltinDispatchInfoBuilder(kernelsLib) { - populate(device, - EBuiltInOps::FillBuffer, - "", - "FillBufferLeftLeftover", kernLeftLeftover, - "FillBufferMiddle", kernMiddle, - "FillBufferRightLeftover", kernRightLeftover); - } + : BuiltInOp(kernelsLib, device, true) {} template bool buildDispatchInfosTyped(MultiDispatchInfo &multiDispatchInfo) const { - DispatchInfoBuilder kernelSplit1DBuilder; + DispatchInfoBuilder kernelSplit1DBuilder(clDevice); auto &operationParams = multiDispatchInfo.peekBuiltinOpParams(); uintptr_t start = reinterpret_cast(operationParams.dstPtr) + operationParams.dstOffset.x; @@ -347,15 +340,23 @@ class BuiltInOp : public BuiltinDispatchInfoBuilder { Kernel *kernMiddle = nullptr; Kernel *kernRightLeftover = nullptr; - BuiltInOp(BuiltIns &kernelsLib) : BuiltinDispatchInfoBuilder(kernelsLib) {} + BuiltInOp(BuiltIns &kernelsLib, ClDevice &device, bool populateKernels) + : BuiltinDispatchInfoBuilder(kernelsLib, device) { + if (populateKernels) { + populate(EBuiltInOps::FillBuffer, + "", + "FillBufferLeftLeftover", kernLeftLeftover, + "FillBufferMiddle", kernMiddle, + "FillBufferRightLeftover", kernRightLeftover); + } + } }; template <> class BuiltInOp : public BuiltInOp { public: - BuiltInOp(BuiltIns &kernelsLib, ClDevice &device) : BuiltInOp(kernelsLib) { - populate(device, - EBuiltInOps::FillBufferStateless, + BuiltInOp(BuiltIns &kernelsLib, ClDevice &device) : BuiltInOp(kernelsLib, device, false) { + populate(EBuiltInOps::FillBufferStateless, CompilerOptions::greaterThan4gbBuffersRequired, "FillBufferLeftLeftover", kernLeftLeftover, "FillBufferMiddle", kernMiddle, @@ -370,16 +371,7 @@ template <> class BuiltInOp : public BuiltinDispatchInfoBuilder { public: BuiltInOp(BuiltIns &kernelsLib, ClDevice &device) - : BuiltinDispatchInfoBuilder(kernelsLib) { - populate(device, - EBuiltInOps::CopyBufferToImage3d, - "", - "CopyBufferToImage3dBytes", kernelBytes[0], - "CopyBufferToImage3d2Bytes", kernelBytes[1], - "CopyBufferToImage3d4Bytes", kernelBytes[2], - "CopyBufferToImage3d8Bytes", kernelBytes[3], - "CopyBufferToImage3d16Bytes", kernelBytes[4]); - } + : BuiltInOp(kernelsLib, device, true) {} bool buildDispatchInfos(MultiDispatchInfo &multiDispatchInfo) const override { return buildDispatchInfosTyped(multiDispatchInfo); @@ -387,11 +379,22 @@ class BuiltInOp : public BuiltinDispatchInfoBu protected: Kernel *kernelBytes[5] = {nullptr}; - BuiltInOp(BuiltIns &kernelsLib) : BuiltinDispatchInfoBuilder(kernelsLib){}; + BuiltInOp(BuiltIns &kernelsLib, ClDevice &device, bool populateKernels) + : BuiltinDispatchInfoBuilder(kernelsLib, device) { + if (populateKernels) { + populate(EBuiltInOps::CopyBufferToImage3d, + "", + "CopyBufferToImage3dBytes", kernelBytes[0], + "CopyBufferToImage3d2Bytes", kernelBytes[1], + "CopyBufferToImage3d4Bytes", kernelBytes[2], + "CopyBufferToImage3d8Bytes", kernelBytes[3], + "CopyBufferToImage3d16Bytes", kernelBytes[4]); + } + } template bool buildDispatchInfosTyped(MultiDispatchInfo &multiDispatchInfo) const { - DispatchInfoBuilder kernelNoSplit3DBuilder; + DispatchInfoBuilder kernelNoSplit3DBuilder(clDevice); auto &operationParams = multiDispatchInfo.peekBuiltinOpParams(); DEBUG_BREAK_IF(!(((operationParams.srcPtr != nullptr) || (operationParams.srcMemObj != nullptr)) && (operationParams.dstPtr == nullptr))); @@ -464,9 +467,8 @@ template <> class BuiltInOp : public BuiltInOp { public: BuiltInOp(BuiltIns &kernelsLib, ClDevice &device) - : BuiltInOp(kernelsLib) { - populate(device, - EBuiltInOps::CopyBufferToImage3dStateless, + : BuiltInOp(kernelsLib, device, false) { + populate(EBuiltInOps::CopyBufferToImage3dStateless, CompilerOptions::greaterThan4gbBuffersRequired, "CopyBufferToImage3dBytes", kernelBytes[0], "CopyBufferToImage3d2Bytes", kernelBytes[1], @@ -484,16 +486,7 @@ template <> class BuiltInOp : public BuiltinDispatchInfoBuilder { public: BuiltInOp(BuiltIns &kernelsLib, ClDevice &device) - : BuiltinDispatchInfoBuilder(kernelsLib) { - populate(device, - EBuiltInOps::CopyImage3dToBuffer, - "", - "CopyImage3dToBufferBytes", kernelBytes[0], - "CopyImage3dToBuffer2Bytes", kernelBytes[1], - "CopyImage3dToBuffer4Bytes", kernelBytes[2], - "CopyImage3dToBuffer8Bytes", kernelBytes[3], - "CopyImage3dToBuffer16Bytes", kernelBytes[4]); - } + : BuiltInOp(kernelsLib, device, true) {} bool buildDispatchInfos(MultiDispatchInfo &multiDispatchInfo) const override { return buildDispatchInfosTyped(multiDispatchInfo); @@ -502,11 +495,22 @@ class BuiltInOp : public BuiltinDispatchInfoBu protected: Kernel *kernelBytes[5] = {nullptr}; - BuiltInOp(BuiltIns &kernelsLib) : BuiltinDispatchInfoBuilder(kernelsLib) {} + BuiltInOp(BuiltIns &kernelsLib, ClDevice &device, bool populateKernels) + : BuiltinDispatchInfoBuilder(kernelsLib, device) { + if (populateKernels) { + populate(EBuiltInOps::CopyImage3dToBuffer, + "", + "CopyImage3dToBufferBytes", kernelBytes[0], + "CopyImage3dToBuffer2Bytes", kernelBytes[1], + "CopyImage3dToBuffer4Bytes", kernelBytes[2], + "CopyImage3dToBuffer8Bytes", kernelBytes[3], + "CopyImage3dToBuffer16Bytes", kernelBytes[4]); + } + } template bool buildDispatchInfosTyped(MultiDispatchInfo &multiDispatchInfo) const { - DispatchInfoBuilder kernelNoSplit3DBuilder; + DispatchInfoBuilder kernelNoSplit3DBuilder(clDevice); auto &operationParams = multiDispatchInfo.peekBuiltinOpParams(); DEBUG_BREAK_IF(!((operationParams.srcPtr == nullptr) && ((operationParams.dstPtr != nullptr) || (operationParams.dstMemObj != nullptr)))); @@ -579,9 +583,8 @@ template <> class BuiltInOp : public BuiltInOp { public: BuiltInOp(BuiltIns &kernelsLib, ClDevice &device) - : BuiltInOp(kernelsLib) { - populate(device, - EBuiltInOps::CopyImage3dToBufferStateless, + : BuiltInOp(kernelsLib, device, false) { + populate(EBuiltInOps::CopyImage3dToBufferStateless, CompilerOptions::greaterThan4gbBuffersRequired, "CopyImage3dToBufferBytes", kernelBytes[0], "CopyImage3dToBuffer2Bytes", kernelBytes[1], @@ -599,15 +602,14 @@ template <> class BuiltInOp : public BuiltinDispatchInfoBuilder { public: BuiltInOp(BuiltIns &kernelsLib, ClDevice &device) - : BuiltinDispatchInfoBuilder(kernelsLib), kernel(nullptr) { - populate(device, - EBuiltInOps::CopyImageToImage3d, + : BuiltinDispatchInfoBuilder(kernelsLib, device) { + populate(EBuiltInOps::CopyImageToImage3d, "", "CopyImageToImage3d", kernel); } bool buildDispatchInfos(MultiDispatchInfo &multiDispatchInfo) const override { - DispatchInfoBuilder kernelNoSplit3DBuilder; + DispatchInfoBuilder kernelNoSplit3DBuilder(clDevice); auto &operationParams = multiDispatchInfo.peekBuiltinOpParams(); DEBUG_BREAK_IF(!((operationParams.srcPtr == nullptr) && (operationParams.dstPtr == nullptr))); @@ -658,22 +660,21 @@ class BuiltInOp : public BuiltinDispatchInfoBui } protected: - Kernel *kernel; + Kernel *kernel = nullptr; }; template <> class BuiltInOp : public BuiltinDispatchInfoBuilder { public: BuiltInOp(BuiltIns &kernelsLib, ClDevice &device) - : BuiltinDispatchInfoBuilder(kernelsLib), kernel(nullptr) { - populate(device, - EBuiltInOps::FillImage3d, + : BuiltinDispatchInfoBuilder(kernelsLib, device) { + populate(EBuiltInOps::FillImage3d, "", "FillImage3d", kernel); } bool buildDispatchInfos(MultiDispatchInfo &multiDispatchInfo) const override { - DispatchInfoBuilder kernelNoSplit3DBuilder; + DispatchInfoBuilder kernelNoSplit3DBuilder(clDevice); auto &operationParams = multiDispatchInfo.peekBuiltinOpParams(); DEBUG_BREAK_IF(!((operationParams.srcMemObj == nullptr) && (operationParams.srcPtr != nullptr) && (operationParams.dstPtr == nullptr))); @@ -716,7 +717,7 @@ class BuiltInOp : public BuiltinDispatchInfoBuilder { } protected: - Kernel *kernel; + Kernel *kernel = nullptr; }; BuiltinDispatchInfoBuilder &BuiltInDispatchBuilderOp::getBuiltinDispatchInfoBuilder(EBuiltInOps::Type operation, ClDevice &device) { diff --git a/opencl/source/built_ins/builtins_dispatch_builder.h b/opencl/source/built_ins/builtins_dispatch_builder.h index 96d16da9c7..2607ccf68e 100644 --- a/opencl/source/built_ins/builtins_dispatch_builder.h +++ b/opencl/source/built_ins/builtins_dispatch_builder.h @@ -56,11 +56,11 @@ struct BuiltinOpParams { class BuiltinDispatchInfoBuilder { public: - BuiltinDispatchInfoBuilder(BuiltIns &kernelLib) : kernelsLib(kernelLib) {} + BuiltinDispatchInfoBuilder(BuiltIns &kernelLib, ClDevice &device) : kernelsLib(kernelLib), clDevice(device) {} virtual ~BuiltinDispatchInfoBuilder() = default; template - void populate(ClDevice &device, EBuiltInOps::Type operation, ConstStringRef options, KernelsDescArgsT &&... desc); + void populate(EBuiltInOps::Type operation, ConstStringRef options, KernelsDescArgsT &&... desc); virtual bool buildDispatchInfos(MultiDispatchInfo &multiDispatchInfo) const { return false; @@ -102,6 +102,7 @@ class BuiltinDispatchInfoBuilder { std::unique_ptr prog; std::vector> usedKernels; BuiltIns &kernelsLib; + ClDevice &clDevice; }; class BuiltInDispatchBuilderOp { diff --git a/opencl/source/built_ins/populate_built_ins.inl b/opencl/source/built_ins/populate_built_ins.inl index 50bb8df3a7..c1678a75be 100644 --- a/opencl/source/built_ins/populate_built_ins.inl +++ b/opencl/source/built_ins/populate_built_ins.inl @@ -9,10 +9,10 @@ namespace NEO { template -void BuiltinDispatchInfoBuilder::populate(ClDevice &device, EBuiltInOps::Type op, ConstStringRef options, KernelsDescArgsT &&... desc) { - auto src = kernelsLib.getBuiltinsLib().getBuiltinCode(op, BuiltinCode::ECodeType::Any, device.getDevice()); +void BuiltinDispatchInfoBuilder::populate(EBuiltInOps::Type op, ConstStringRef options, KernelsDescArgsT &&... desc) { + auto src = kernelsLib.getBuiltinsLib().getBuiltinCode(op, BuiltinCode::ECodeType::Any, clDevice.getDevice()); ClDeviceVector deviceVector; - deviceVector.push_back(&device); + deviceVector.push_back(&clDevice); prog.reset(BuiltinDispatchInfoBuilder::createProgramFromCode(src, deviceVector).release()); prog->build(deviceVector, options.data(), kernelsLib.isCacheingEnabled()); grabKernels(std::forward(desc)...); diff --git a/opencl/source/built_ins/vme_dispatch_builder.h b/opencl/source/built_ins/vme_dispatch_builder.h index 61d8f9b90b..d726797035 100644 --- a/opencl/source/built_ins/vme_dispatch_builder.h +++ b/opencl/source/built_ins/vme_dispatch_builder.h @@ -22,8 +22,8 @@ class VmeBuiltinDispatchInfoBuilder : public BuiltinDispatchInfoBuilder { public: VmeBuiltinDispatchInfoBuilder(BuiltIns &kernelsLib, ClDevice &device, EBuiltInOps::Type builtinOp, const char *kernelName) - : BuiltinDispatchInfoBuilder(kernelsLib) { - populate(device, builtinOp, + : BuiltinDispatchInfoBuilder(kernelsLib, device) { + populate(builtinOp, mediaKernelsBuildOptions, kernelName, vmeKernel); widthArgNum = vmeKernel->getKernelInfo().getArgNumByName("width"); @@ -70,7 +70,7 @@ class VmeBuiltinDispatchInfoBuilder : public BuiltinDispatchInfoBuilder { Vec3 gws = {numThreadsX * simdWidth, 1, 1}; Vec3 lws = {vmeKernel->getKernelInfo().kernelDescriptor.kernelAttributes.requiredWorkgroupSize[0], 1, 1}; - DispatchInfoBuilder builder; + DispatchInfoBuilder builder(clDevice); builder.setDispatchGeometry(gws, lws, inOffset, gws, lws); builder.setKernel(vmeKernel); builder.bake(multiDispatchInfo); diff --git a/opencl/source/command_queue/enqueue_common.h b/opencl/source/command_queue/enqueue_common.h index db60997d90..4a17ee774c 100644 --- a/opencl/source/command_queue/enqueue_common.h +++ b/opencl/source/command_queue/enqueue_common.h @@ -75,7 +75,7 @@ void CommandQueueHw::enqueueHandler(Surface *(&surfaces)[surfaceCount } if (kernel->getKernelInfo().builtinDispatchBuilder == nullptr) { - DispatchInfoBuilder builder; + DispatchInfoBuilder builder(getClDevice()); builder.setDispatchGeometry(workDim, workItems, enqueuedWorkSizes, globalOffsets, Vec3{0, 0, 0}, localWorkSizesIn); builder.setKernel(kernel); builder.bake(multiDispatchInfo); @@ -105,11 +105,12 @@ void CommandQueueHw::enqueueHandler(Surface *(&surfaces)[surfaceCount template void CommandQueueHw::forceDispatchScheduler(NEO::MultiDispatchInfo &multiDispatchInfo) { SchedulerKernel &scheduler = getContext().getSchedulerKernel(); - DispatchInfo dispatchInfo(&scheduler, 1, Vec3(scheduler.getGws(), 1, 1), Vec3(scheduler.getLws(), 1, 1), Vec3(0, 0, 0)); auto devQueue = this->getContext().getDefaultDeviceQueue(); DeviceQueueHw *devQueueHw = castToObjectOrAbort>(devQueue); + DispatchInfo dispatchInfo(devQueue->getClDevice(), &scheduler, 1, Vec3(scheduler.getGws(), 1, 1), Vec3(scheduler.getLws(), 1, 1), Vec3(0, 0, 0)); + scheduler.createReflectionSurface(); GraphicsAllocation *reflectionSurface = scheduler.getKernelReflectionSurface(); diff --git a/opencl/source/command_queue/local_work_size.cpp b/opencl/source/command_queue/local_work_size.cpp index ea5d086c52..e714d0dbec 100644 --- a/opencl/source/command_queue/local_work_size.cpp +++ b/opencl/source/command_queue/local_work_size.cpp @@ -414,9 +414,10 @@ Vec3 computeWorkgroupSize(const DispatchInfo &dispatchInfo) { auto kernel = dispatchInfo.getKernel(); if (kernel != nullptr) { - const auto &hwInfo = kernel->getDevice().getHardwareInfo(); + auto &device = dispatchInfo.getClDevice(); + const auto &hwInfo = device.getHardwareInfo(); auto &hwHelper = HwHelper::get(hwInfo.platform.eRenderCoreFamily); - auto isSimulation = kernel->getDevice().isSimulation(); + auto isSimulation = device.isSimulation(); if (kernel->requiresLimitedWorkgroupSize() && hwHelper.isSpecialWorkgroupSizeRequired(hwInfo, isSimulation)) { setSpecialWorkgroupSize(workGroupSize); } else if (DebugManager.flags.EnableComputeWorkSizeND.get()) { diff --git a/opencl/source/device_queue/device_queue.cpp b/opencl/source/device_queue/device_queue.cpp index bbe0ce1edf..8c2254c935 100644 --- a/opencl/source/device_queue/device_queue.cpp +++ b/opencl/source/device_queue/device_queue.cpp @@ -96,6 +96,10 @@ Device &DeviceQueue::getDevice() { return device->getDevice(); } +ClDevice *DeviceQueue::getClDevice() const { + return device; +} + cl_int DeviceQueue::getCommandQueueInfo(cl_command_queue_info paramName, size_t paramValueSize, void *paramValue, size_t *paramValueSizeRet) { diff --git a/opencl/source/device_queue/device_queue.h b/opencl/source/device_queue/device_queue.h index 8d4e5a9f5b..ebd2fce080 100644 --- a/opencl/source/device_queue/device_queue.h +++ b/opencl/source/device_queue/device_queue.h @@ -46,6 +46,7 @@ class DeviceQueue : public BaseObject<_device_queue> { ~DeviceQueue() override; Device &getDevice(); + ClDevice *getClDevice() const; Context &getContext() { return *context; } cl_uint getQueueSize() { return queueSize; } cl_command_queue_properties getCommandQueueProperties() const { return commandQueueProperties; } diff --git a/opencl/source/helpers/dispatch_info.h b/opencl/source/helpers/dispatch_info.h index 1811a075c1..cbf2997ced 100644 --- a/opencl/source/helpers/dispatch_info.h +++ b/opencl/source/helpers/dispatch_info.h @@ -21,6 +21,7 @@ namespace NEO { class Kernel; +class ClDevice; struct TimestampPacketDependencies; class DispatchInfo { @@ -30,10 +31,13 @@ class DispatchInfo { using EstimateCommandsMethodT = size_t(size_t, const HardwareInfo &, bool); DispatchInfo() = default; - DispatchInfo(Kernel *kernel, uint32_t dim, Vec3 gws, Vec3 elws, Vec3 offset) - : kernel(kernel), dim(dim), gws(gws), elws(elws), offset(offset) {} - DispatchInfo(Kernel *kernel, uint32_t dim, Vec3 gws, Vec3 elws, Vec3 offset, Vec3 agws, Vec3 lws, Vec3 twgs, Vec3 nwgs, Vec3 swgs) - : kernel(kernel), dim(dim), gws(gws), elws(elws), offset(offset), agws(agws), lws(lws), twgs(twgs), nwgs(nwgs), swgs(swgs) {} + DispatchInfo(ClDevice *device, Kernel *kernel, uint32_t dim, Vec3 gws, Vec3 elws, Vec3 offset) + : pClDevice(device), kernel(kernel), dim(dim), gws(gws), elws(elws), offset(offset) {} + DispatchInfo(ClDevice *device, Kernel *kernel, uint32_t dim, Vec3 gws, Vec3 elws, Vec3 offset, Vec3 agws, Vec3 lws, Vec3 twgs, Vec3 nwgs, Vec3 swgs) + : pClDevice(device), kernel(kernel), dim(dim), gws(gws), elws(elws), offset(offset), agws(agws), lws(lws), twgs(twgs), nwgs(nwgs), swgs(swgs) {} + + ClDevice &getClDevice() const { return *pClDevice; } + void setClDevice(ClDevice *device) { pClDevice = device; } bool usesSlm() const; bool usesStatelessPrintfSurface() const; uint32_t getRequiredScratchSize() const; @@ -65,6 +69,7 @@ class DispatchInfo { RegisteredMethodDispatcher dispatchEpilogueCommands; protected: + ClDevice *pClDevice = nullptr; bool canBePartitioned = false; Kernel *kernel = nullptr; uint32_t dim = 0; diff --git a/opencl/source/helpers/dispatch_info_builder.h b/opencl/source/helpers/dispatch_info_builder.h index bb9e3c2498..d69aebf0ea 100644 --- a/opencl/source/helpers/dispatch_info_builder.h +++ b/opencl/source/helpers/dispatch_info_builder.h @@ -62,7 +62,11 @@ static constexpr uint32_t powConst(uint32_t base, uint32_t currExp) { template class DispatchInfoBuilder { public: - DispatchInfoBuilder() = default; + DispatchInfoBuilder(ClDevice &clDevice) { + for (auto i = 0u; i < numDispatches; i++) { + dispatchInfos[i].setClDevice(&clDevice); + } + }; void setKernel(Kernel *kernel) { for (auto &dispatchInfo : dispatchInfos) { @@ -321,7 +325,7 @@ class DispatchInfoBuilder { Vec3 mainSWGS = {0, 0, 0}; Vec3 rightSWGS = {mainNWGS.x, 0, 0}; - DispatchInfoBuilder builder1D; + DispatchInfoBuilder builder1D(dispatchInfo.getClDevice()); builder1D.setKernel(dispatchInfo.getKernel()); @@ -351,7 +355,7 @@ class DispatchInfoBuilder { Vec3 bottomSWGS = {0, mainNWGS.y, 0}; Vec3 rightbottomSWGS = {mainNWGS.x, mainNWGS.y, 0}; - DispatchInfoBuilder builder2D; + DispatchInfoBuilder builder2D(dispatchInfo.getClDevice()); builder2D.setKernel(dispatchInfo.getKernel()); @@ -399,7 +403,7 @@ class DispatchInfoBuilder { Vec3 bottombackSWGS = {0, mainNWGS.y, mainNWGS.z}; Vec3 rightbottombackSWGS = {mainNWGS.x, mainNWGS.y, mainNWGS.z}; - DispatchInfoBuilder builder3D; + DispatchInfoBuilder builder3D(dispatchInfo.getClDevice()); builder3D.setKernel(dispatchInfo.getKernel()); diff --git a/opencl/source/kernel/kernel.cpp b/opencl/source/kernel/kernel.cpp index dbd22761b1..eda9a1fd43 100644 --- a/opencl/source/kernel/kernel.cpp +++ b/opencl/source/kernel/kernel.cpp @@ -988,7 +988,7 @@ cl_int Kernel::setKernelExecutionType(cl_execution_info_kernel_type_intel execut } void Kernel::getSuggestedLocalWorkSize(const cl_uint workDim, const size_t *globalWorkSize, const size_t *globalWorkOffset, - size_t *localWorkSize) { + size_t *localWorkSize, ClDevice &clDevice) { UNRECOVERABLE_IF((workDim == 0) || (workDim > 3)); UNRECOVERABLE_IF(globalWorkSize == nullptr); Vec3 elws{0, 0, 0}; @@ -1007,7 +1007,7 @@ void Kernel::getSuggestedLocalWorkSize(const cl_uint workDim, const size_t *glob } } - const DispatchInfo dispatchInfo{this, workDim, gws, elws, offset}; + const DispatchInfo dispatchInfo{&clDevice, this, workDim, gws, elws, offset}; auto suggestedLws = computeWorkgroupSize(dispatchInfo); localWorkSize[0] = suggestedLws.x; diff --git a/opencl/source/kernel/kernel.h b/opencl/source/kernel/kernel.h index a1b0b16443..c758a10b58 100644 --- a/opencl/source/kernel/kernel.h +++ b/opencl/source/kernel/kernel.h @@ -405,7 +405,7 @@ class Kernel : public BaseObject<_cl_kernel> { this->threadArbitrationPolicy = policy; } void getSuggestedLocalWorkSize(const cl_uint workDim, const size_t *globalWorkSize, const size_t *globalWorkOffset, - size_t *localWorkSize); + size_t *localWorkSize, ClDevice &clDevice); uint32_t getMaxWorkGroupCount(const cl_uint workDim, const size_t *localWorkSize, const CommandQueue *commandQueue) const; uint64_t getKernelStartOffset( diff --git a/opencl/source/program/kernel_info.cpp b/opencl/source/program/kernel_info.cpp index 108163f60d..91e75384b9 100644 --- a/opencl/source/program/kernel_info.cpp +++ b/opencl/source/program/kernel_info.cpp @@ -132,15 +132,16 @@ WorkSizeInfo::WorkSizeInfo(uint32_t maxWorkGroupSize, bool hasBarriers, uint32_t setMinWorkGroupSize(); } WorkSizeInfo::WorkSizeInfo(const DispatchInfo &dispatchInfo) { + auto &device = dispatchInfo.getClDevice(); this->maxWorkGroupSize = dispatchInfo.getKernel()->maxKernelWorkGroupSize; auto pExecutionEnvironment = dispatchInfo.getKernel()->getKernelInfo().patchInfo.executionEnvironment; this->hasBarriers = (pExecutionEnvironment != nullptr) && (pExecutionEnvironment->HasBarriers); this->simdSize = (uint32_t)dispatchInfo.getKernel()->getKernelInfo().getMaxSimdSize(); this->slmTotalSize = (uint32_t)dispatchInfo.getKernel()->slmTotalSize; - this->coreFamily = dispatchInfo.getKernel()->getDevice().getHardwareInfo().platform.eRenderCoreFamily; - this->numThreadsPerSubSlice = (uint32_t)dispatchInfo.getKernel()->getDevice().getSharedDeviceInfo().maxNumEUsPerSubSlice * - dispatchInfo.getKernel()->getDevice().getSharedDeviceInfo().numThreadsPerEU; - this->localMemSize = (uint32_t)dispatchInfo.getKernel()->getDevice().getSharedDeviceInfo().localMemSize; + this->coreFamily = device.getHardwareInfo().platform.eRenderCoreFamily; + this->numThreadsPerSubSlice = static_cast(device.getSharedDeviceInfo().maxNumEUsPerSubSlice) * + device.getSharedDeviceInfo().numThreadsPerEU; + this->localMemSize = static_cast(device.getSharedDeviceInfo().localMemSize); setIfUseImg(dispatchInfo.getKernel()); setMinWorkGroupSize(); } diff --git a/opencl/test/unit_test/api/cl_get_kernel_suggested_local_work_size_intel_tests.inl b/opencl/test/unit_test/api/cl_get_kernel_suggested_local_work_size_intel_tests.inl index 1e08ba5a9e..077eabce97 100644 --- a/opencl/test/unit_test/api/cl_get_kernel_suggested_local_work_size_intel_tests.inl +++ b/opencl/test/unit_test/api/cl_get_kernel_suggested_local_work_size_intel_tests.inl @@ -62,7 +62,7 @@ TEST_F(clGetKernelSuggestedLocalWorkSizeTests, GivenVariousInputWhenGettingSugge Vec3 elws{0, 0, 0}; Vec3 gws{128, 128, 128}; Vec3 offset{0, 0, 0}; - DispatchInfo dispatchInfo{pKernel, 1, gws, elws, offset}; + DispatchInfo dispatchInfo{pDevice, pKernel, 1, gws, elws, offset}; auto expectedLws = computeWorkgroupSize(dispatchInfo); EXPECT_GT(expectedLws.x, 1u); @@ -107,7 +107,7 @@ TEST_F(clGetKernelSuggestedLocalWorkSizeTests, GivenKernelWithExecutionEnvironme Vec3 elws{0, 0, 0}; Vec3 gws{128, 128, 128}; Vec3 offset{0, 0, 0}; - const DispatchInfo dispatchInfo{kernelWithExecutionEnvironmentPatch.get(), workDim, gws, elws, offset}; + const DispatchInfo dispatchInfo{pDevice, kernelWithExecutionEnvironmentPatch.get(), workDim, gws, elws, offset}; auto expectedLws = computeWorkgroupSize(dispatchInfo); EXPECT_GT(expectedLws.x * expectedLws.y * expectedLws.z, 1u); diff --git a/opencl/test/unit_test/built_ins/built_in_tests.cpp b/opencl/test/unit_test/built_ins/built_in_tests.cpp index cf9335dfcc..a4c217899e 100644 --- a/opencl/test/unit_test/built_ins/built_in_tests.cpp +++ b/opencl/test/unit_test/built_ins/built_in_tests.cpp @@ -937,35 +937,35 @@ HWCMDTEST_F(IGFX_GEN8_CORE, BuiltInTests, WhenGetttingSchedulerKernelForSecondTi } TEST_F(BuiltInTests, GivenUnsupportedBuildTypeWhenBuildingDispatchInfoThenFalseIsReturned) { - auto &bs = *pDevice->getBuiltIns(); - BuiltinDispatchInfoBuilder bdib{bs}; + auto &builtIns = *pDevice->getBuiltIns(); + BuiltinDispatchInfoBuilder dispatchInfoBuilder{builtIns, *pClDevice}; BuiltinOpParams params; MultiDispatchInfo multiDispatchInfo(params); - auto ret = bdib.buildDispatchInfos(multiDispatchInfo); + auto ret = dispatchInfoBuilder.buildDispatchInfos(multiDispatchInfo); EXPECT_FALSE(ret); ASSERT_EQ(0U, multiDispatchInfo.size()); - ret = bdib.buildDispatchInfos(multiDispatchInfo, nullptr, 0, Vec3{0, 0, 0}, Vec3{0, 0, 0}, Vec3{0, 0, 0}); + ret = dispatchInfoBuilder.buildDispatchInfos(multiDispatchInfo, nullptr, 0, Vec3{0, 0, 0}, Vec3{0, 0, 0}, Vec3{0, 0, 0}); EXPECT_FALSE(ret); EXPECT_EQ(0U, multiDispatchInfo.size()); } TEST_F(BuiltInTests, GivenDefaultBuiltinDispatchInfoBuilderWhenValidateDispatchIsCalledThenClSuccessIsReturned) { - auto &bs = *pDevice->getBuiltIns(); - BuiltinDispatchInfoBuilder bdib{bs}; - auto ret = bdib.validateDispatch(nullptr, 1, Vec3{0, 0, 0}, Vec3{0, 0, 0}, Vec3{0, 0, 0}); + auto &builtIns = *pDevice->getBuiltIns(); + BuiltinDispatchInfoBuilder dispatchInfoBuilder{builtIns, *pClDevice}; + auto ret = dispatchInfoBuilder.validateDispatch(nullptr, 1, Vec3{0, 0, 0}, Vec3{0, 0, 0}, Vec3{0, 0, 0}); EXPECT_EQ(CL_SUCCESS, ret); } TEST_F(BuiltInTests, WhenSettingExplictArgThenTrueIsReturned) { - auto &bs = *pDevice->getBuiltIns(); - BuiltinDispatchInfoBuilder bdib{bs}; + auto &builtIns = *pDevice->getBuiltIns(); + BuiltinDispatchInfoBuilder dispatchInfoBuilder{builtIns, *pClDevice}; MultiDispatchInfo multiDispatchInfo; BuiltinOpParams params; cl_int err; - auto ret = bdib.setExplicitArg(1, 5, nullptr, err); + auto ret = dispatchInfoBuilder.setExplicitArg(1, 5, nullptr, err); EXPECT_TRUE(ret); } diff --git a/opencl/test/unit_test/command_queue/command_queue_fixture.cpp b/opencl/test/unit_test/command_queue/command_queue_fixture.cpp index bb09a4ee14..538eaa480e 100644 --- a/opencl/test/unit_test/command_queue/command_queue_fixture.cpp +++ b/opencl/test/unit_test/command_queue/command_queue_fixture.cpp @@ -37,6 +37,7 @@ CommandQueue *CommandQueueHwFixture::createCommandQueue( if (pDevice == nullptr) { if (this->device == nullptr) { this->device = new MockClDevice{MockDevice::createWithNewExecutionEnvironment(nullptr)}; + createdDevice = true; } pDevice = this->device; } @@ -74,7 +75,7 @@ void CommandQueueHwFixture::TearDown() { if (context) { context->release(); } - if (device) { + if (createdDevice) { delete device; } } diff --git a/opencl/test/unit_test/command_queue/command_queue_fixture.h b/opencl/test/unit_test/command_queue/command_queue_fixture.h index a123899e69..a0e9455e5e 100644 --- a/opencl/test/unit_test/command_queue/command_queue_fixture.h +++ b/opencl/test/unit_test/command_queue/command_queue_fixture.h @@ -34,8 +34,9 @@ struct CommandQueueHwFixture { virtual void TearDown(); CommandQueue *pCmdQ = nullptr; - ClDevice *device = nullptr; + MockClDevice *device = nullptr; MockContext *context = nullptr; + bool createdDevice = false; }; struct OOQueueFixture : public CommandQueueHwFixture { diff --git a/opencl/test/unit_test/command_queue/command_queue_hw_tests.cpp b/opencl/test/unit_test/command_queue/command_queue_hw_tests.cpp index 32e943be41..271b3cfdc2 100644 --- a/opencl/test/unit_test/command_queue/command_queue_hw_tests.cpp +++ b/opencl/test/unit_test/command_queue/command_queue_hw_tests.cpp @@ -738,8 +738,7 @@ void CloneMdi(MultiDispatchInfo &dst, const MultiDispatchInfo &src) { } struct MockBuilder : BuiltinDispatchInfoBuilder { - MockBuilder(NEO::BuiltIns &builtins) : BuiltinDispatchInfoBuilder(builtins) { - } + using BuiltinDispatchInfoBuilder::BuiltinDispatchInfoBuilder; bool buildDispatchInfos(MultiDispatchInfo &d) const override { wasBuildDispatchInfosWithBuiltinOpParamsCalled = true; paramsReceived.multiDispatchInfo.setBuiltinOpParams(d.peekBuiltinOpParams()); @@ -753,10 +752,10 @@ struct MockBuilder : BuiltinDispatchInfoBuilder { paramsReceived.offset = offset; wasBuildDispatchInfosWithKernelParamsCalled = true; - DispatchInfoBuilder dib; - dib.setKernel(paramsToUse.kernel); - dib.setDispatchGeometry(dim, paramsToUse.gws, paramsToUse.elws, paramsToUse.offset); - dib.bake(d); + DispatchInfoBuilder dispatchInfoBuilder(clDevice); + dispatchInfoBuilder.setKernel(paramsToUse.kernel); + dispatchInfoBuilder.setDispatchGeometry(dim, paramsToUse.gws, paramsToUse.elws, paramsToUse.offset); + dispatchInfoBuilder.bake(d); CloneMdi(paramsReceived.multiDispatchInfo, d); return true; @@ -786,7 +785,7 @@ struct BuiltinParamsCommandQueueHwTests : public CommandQueueHwTest { operation, *pContext, *pDevice, - std::unique_ptr(new MockBuilder(*builtIns))); + std::unique_ptr(new MockBuilder(*builtIns, pCmdQ->getClDevice()))); mockBuilder = static_cast(&BuiltInDispatchBuilderOp::getBuiltinDispatchInfoBuilder( operation, @@ -1001,7 +1000,7 @@ HWTEST_F(CommandQueueHwTest, GivenBuiltinKernelWhenBuiltinDispatchInfoBuilderIsP CommandQueueHw *cmdQHw = static_cast *>(this->pCmdQ); MockKernelWithInternals mockKernelToUse(*pClDevice); - MockBuilder builder(*pDevice->getBuiltIns()); + MockBuilder builder(*pDevice->getBuiltIns(), *pClDevice); builder.paramsToUse.gws.x = 11; builder.paramsToUse.elws.x = 13; builder.paramsToUse.offset.x = 17; diff --git a/opencl/test/unit_test/command_queue/command_queue_tests.cpp b/opencl/test/unit_test/command_queue/command_queue_tests.cpp index 011ea04226..693d1232e1 100644 --- a/opencl/test/unit_test/command_queue/command_queue_tests.cpp +++ b/opencl/test/unit_test/command_queue/command_queue_tests.cpp @@ -465,7 +465,7 @@ HWTEST_F(CommandQueueCommandStreamTest, givenMultiDispatchInfoWithSingleKernelWi MockGraphicsAllocation cacheRequiringAllocation; mockKernelWithInternals.mockKernel->kernelArgRequiresCacheFlush[0] = &cacheRequiringAllocation; - MockMultiDispatchInfo multiDispatchInfo(std::vector({mockKernelWithInternals.mockKernel})); + MockMultiDispatchInfo multiDispatchInfo(pClDevice, std::vector({mockKernelWithInternals.mockKernel})); size_t estimatedNodesCount = cmdQ.estimateTimestampPacketNodesCount(multiDispatchInfo); EXPECT_EQ(estimatedNodesCount, multiDispatchInfo.size()); @@ -482,7 +482,7 @@ HWTEST_F(CommandQueueCommandStreamTest, givenMultiDispatchInfoWithSingleKernelWi MockGraphicsAllocation cacheRequiringAllocation; mockKernelWithInternals.mockKernel->kernelArgRequiresCacheFlush[0] = &cacheRequiringAllocation; - MockMultiDispatchInfo multiDispatchInfo(std::vector({mockKernelWithInternals.mockKernel})); + MockMultiDispatchInfo multiDispatchInfo(pClDevice, std::vector({mockKernelWithInternals.mockKernel})); size_t estimatedNodesCount = cmdQ.estimateTimestampPacketNodesCount(multiDispatchInfo); EXPECT_EQ(estimatedNodesCount, multiDispatchInfo.size() + 1); diff --git a/opencl/test/unit_test/command_queue/dispatch_walker_tests.cpp b/opencl/test/unit_test/command_queue/dispatch_walker_tests.cpp index ea52a3d544..d306f2fa73 100644 --- a/opencl/test/unit_test/command_queue/dispatch_walker_tests.cpp +++ b/opencl/test/unit_test/command_queue/dispatch_walker_tests.cpp @@ -169,7 +169,7 @@ HWTEST_F(DispatchWalkerTest, WhenDispatchingWalkerThenCommandStreamMemoryIsntCha size_t globalOffsets[3] = {0, 0, 0}; size_t workItems[3] = {1, 1, 1}; cl_uint dimensions = 1; - DispatchInfo dispatchInfo(const_cast(&kernel), dimensions, workItems, nullptr, globalOffsets); + DispatchInfo dispatchInfo(pClDevice, const_cast(&kernel), dimensions, workItems, nullptr, globalOffsets); MultiDispatchInfo multiDispatchInfo; multiDispatchInfo.push(dispatchInfo); HardwareInterface::dispatchWalker( @@ -216,7 +216,7 @@ HWTEST_F(DispatchWalkerTest, GivenNoLocalIdsWhenDispatchingWalkerThenWalkerIsDis size_t globalOffsets[3] = {0, 0, 0}; size_t workItems[3] = {1, 1, 1}; cl_uint dimensions = 1; - DispatchInfo dispatchInfo(const_cast(&kernel), dimensions, workItems, nullptr, globalOffsets); + DispatchInfo dispatchInfo(pClDevice, const_cast(&kernel), dimensions, workItems, nullptr, globalOffsets); MultiDispatchInfo multiDispatchInfo; multiDispatchInfo.push(dispatchInfo); HardwareInterface::dispatchWalker( @@ -245,7 +245,7 @@ HWTEST_F(DispatchWalkerTest, GivenDefaultLwsAlgorithmWhenDispatchingWalkerThenDi for (uint32_t dimension = 1; dimension <= 3; ++dimension) { workItems[dimension - 1] = 256; - DispatchInfo dispatchInfo(const_cast(&kernel), dimension, workItems, nullptr, globalOffsets); + DispatchInfo dispatchInfo(pClDevice, const_cast(&kernel), dimension, workItems, nullptr, globalOffsets); MultiDispatchInfo multiDispatchInfo; multiDispatchInfo.push(dispatchInfo); HardwareInterface::dispatchWalker( @@ -275,7 +275,7 @@ HWTEST_F(DispatchWalkerTest, GivenSquaredLwsAlgorithmWhenDispatchingWalkerThenDi size_t workItems[3] = {1, 1, 1}; for (uint32_t dimension = 1; dimension <= 3; ++dimension) { workItems[dimension - 1] = 256; - DispatchInfo dispatchInfo(const_cast(&kernel), dimension, workItems, nullptr, globalOffsets); + DispatchInfo dispatchInfo(pClDevice, const_cast(&kernel), dimension, workItems, nullptr, globalOffsets); MultiDispatchInfo multiDispatchInfo; multiDispatchInfo.push(dispatchInfo); HardwareInterface::dispatchWalker( @@ -303,7 +303,7 @@ HWTEST_F(DispatchWalkerTest, GivenNdLwsAlgorithmWhenDispatchingWalkerThenDimensi size_t workItems[3] = {1, 1, 1}; for (uint32_t dimension = 1; dimension <= 3; ++dimension) { workItems[dimension - 1] = 256; - DispatchInfo dispatchInfo(const_cast(&kernel), dimension, workItems, nullptr, globalOffsets); + DispatchInfo dispatchInfo(pClDevice, const_cast(&kernel), dimension, workItems, nullptr, globalOffsets); MultiDispatchInfo multiDispatchInfo; multiDispatchInfo.push(dispatchInfo); HardwareInterface::dispatchWalker( @@ -332,7 +332,7 @@ HWTEST_F(DispatchWalkerTest, GivenOldLwsAlgorithmWhenDispatchingWalkerThenDimens size_t workItems[3] = {1, 1, 1}; for (uint32_t dimension = 1; dimension <= 3; ++dimension) { workItems[dimension - 1] = 256; - DispatchInfo dispatchInfo(const_cast(&kernel), dimension, workItems, nullptr, globalOffsets); + DispatchInfo dispatchInfo(pClDevice, const_cast(&kernel), dimension, workItems, nullptr, globalOffsets); MultiDispatchInfo multiDispatchInfo; multiDispatchInfo.push(dispatchInfo); HardwareInterface::dispatchWalker( @@ -361,7 +361,7 @@ HWTEST_F(DispatchWalkerTest, GivenNumWorkGroupsWhenDispatchingWalkerThenNumWorkG size_t workGroupSize[3] = {1, 1, 1}; cl_uint dimensions = 3; - DispatchInfo dispatchInfo(const_cast(&kernel), dimensions, workItems, workGroupSize, globalOffsets); + DispatchInfo dispatchInfo(pClDevice, const_cast(&kernel), dimensions, workItems, workGroupSize, globalOffsets); MultiDispatchInfo multiDispatchInfo; multiDispatchInfo.push(dispatchInfo); HardwareInterface::dispatchWalker( @@ -392,7 +392,7 @@ HWTEST_F(DispatchWalkerTest, GivenNoLocalWorkSizeAndDefaultAlgorithmWhenDispatch size_t globalOffsets[3] = {0, 0, 0}; size_t workItems[3] = {2, 5, 10}; cl_uint dimensions = 3; - DispatchInfo dispatchInfo(const_cast(&kernel), dimensions, workItems, nullptr, globalOffsets); + DispatchInfo dispatchInfo(pClDevice, const_cast(&kernel), dimensions, workItems, nullptr, globalOffsets); MultiDispatchInfo multiDispatchInfo; multiDispatchInfo.push(dispatchInfo); HardwareInterface::dispatchWalker( @@ -422,7 +422,7 @@ HWTEST_F(DispatchWalkerTest, GivenNoLocalWorkSizeAndNdOnWhenDispatchingWalkerThe size_t globalOffsets[3] = {0, 0, 0}; size_t workItems[3] = {2, 5, 10}; cl_uint dimensions = 3; - DispatchInfo dispatchInfo(const_cast(&kernel), dimensions, workItems, nullptr, globalOffsets); + DispatchInfo dispatchInfo(pClDevice, const_cast(&kernel), dimensions, workItems, nullptr, globalOffsets); MultiDispatchInfo multiDispatchInfo; multiDispatchInfo.push(dispatchInfo); HardwareInterface::dispatchWalker( @@ -453,7 +453,7 @@ HWTEST_F(DispatchWalkerTest, GivenNoLocalWorkSizeAndSquaredAlgorithmWhenDispatch size_t globalOffsets[3] = {0, 0, 0}; size_t workItems[3] = {2, 5, 10}; cl_uint dimensions = 3; - DispatchInfo dispatchInfo(const_cast(&kernel), dimensions, workItems, nullptr, globalOffsets); + DispatchInfo dispatchInfo(pClDevice, const_cast(&kernel), dimensions, workItems, nullptr, globalOffsets); MultiDispatchInfo multiDispatchInfo; multiDispatchInfo.push(dispatchInfo); HardwareInterface::dispatchWalker( @@ -484,7 +484,7 @@ HWTEST_F(DispatchWalkerTest, GivenNoLocalWorkSizeAndSquaredAlgorithmOffAndNdOffW size_t globalOffsets[3] = {0, 0, 0}; size_t workItems[3] = {2, 5, 10}; cl_uint dimensions = 3; - DispatchInfo dispatchInfo(const_cast(&kernel), dimensions, workItems, nullptr, globalOffsets); + DispatchInfo dispatchInfo(pClDevice, const_cast(&kernel), dimensions, workItems, nullptr, globalOffsets); MultiDispatchInfo multiDispatchInfo; multiDispatchInfo.push(dispatchInfo); HardwareInterface::dispatchWalker( @@ -513,7 +513,7 @@ HWTEST_F(DispatchWalkerTest, GivenNoLocalWorkSizeWhenDispatchingWalkerThenLwsIsC size_t workItems[3] = {2, 5, 10}; size_t workGroupSize[3] = {1, 2, 3}; cl_uint dimensions = 3; - DispatchInfo dispatchInfo(const_cast(&kernel), dimensions, workItems, workGroupSize, globalOffsets); + DispatchInfo dispatchInfo(pClDevice, const_cast(&kernel), dimensions, workItems, workGroupSize, globalOffsets); MultiDispatchInfo multiDispatchInfo; multiDispatchInfo.push(dispatchInfo); HardwareInterface::dispatchWalker( @@ -545,7 +545,7 @@ HWTEST_F(DispatchWalkerTest, GivenTwoSetsOfLwsOffsetsWhenDispatchingWalkerThenLw size_t workItems[3] = {2, 5, 10}; size_t workGroupSize[3] = {1, 2, 3}; cl_uint dimensions = 3; - DispatchInfo dispatchInfo(const_cast(&kernel), dimensions, workItems, workGroupSize, globalOffsets); + DispatchInfo dispatchInfo(pClDevice, const_cast(&kernel), dimensions, workItems, workGroupSize, globalOffsets); MultiDispatchInfo multiDispatchInfo; multiDispatchInfo.push(dispatchInfo); HardwareInterface::dispatchWalker( @@ -579,8 +579,8 @@ HWTEST_F(DispatchWalkerTest, GivenSplitKernelWhenDispatchingWalkerThenLwsIsCorre kernelInfoWithSampler.workloadInfo.localWorkSizeOffsets[2] = 20; ASSERT_EQ(CL_SUCCESS, kernel2.initialize()); - DispatchInfo di1(&kernel1, 3, {10, 10, 10}, {1, 2, 3}, {0, 0, 0}); - DispatchInfo di2(&kernel2, 3, {10, 10, 10}, {4, 5, 6}, {0, 0, 0}); + DispatchInfo di1(pClDevice, &kernel1, 3, {10, 10, 10}, {1, 2, 3}, {0, 0, 0}); + DispatchInfo di2(pClDevice, &kernel2, 3, {10, 10, 10}, {4, 5, 6}, {0, 0, 0}); MockMultiDispatchInfo multiDispatchInfo(std::vector({&di1, &di2})); @@ -627,8 +627,8 @@ HWTEST_F(DispatchWalkerTest, GivenSplitWalkerWhenDispatchingWalkerThenLwsIsCorre ASSERT_EQ(CL_SUCCESS, kernel1.initialize()); ASSERT_EQ(CL_SUCCESS, mainKernel.initialize()); - DispatchInfo di1(&kernel1, 3, {10, 10, 10}, {1, 2, 3}, {0, 0, 0}); - DispatchInfo di2(&mainKernel, 3, {10, 10, 10}, {4, 5, 6}, {0, 0, 0}); + DispatchInfo di1(pClDevice, &kernel1, 3, {10, 10, 10}, {1, 2, 3}, {0, 0, 0}); + DispatchInfo di2(pClDevice, &mainKernel, 3, {10, 10, 10}, {4, 5, 6}, {0, 0, 0}); MultiDispatchInfo multiDispatchInfo(&mainKernel); multiDispatchInfo.push(di1); @@ -682,7 +682,7 @@ HWTEST_F(DispatchWalkerTest, GivenBlockedQueueWhenDispatchingWalkerThenCommandSt auto blockedCommandsData = createBlockedCommandsData(*pCmdQ); - DispatchInfo dispatchInfo(const_cast(&kernel), dimensions, workItems, workGroupSize, globalOffsets); + DispatchInfo dispatchInfo(pClDevice, const_cast(&kernel), dimensions, workItems, workGroupSize, globalOffsets); MultiDispatchInfo multiDispatchInfo; multiDispatchInfo.push(dispatchInfo); HardwareInterface::dispatchWalker( @@ -715,7 +715,7 @@ HWTEST_F(DispatchWalkerTest, GivenBlockedQueueWhenDispatchingWalkerThenRequiredH cl_uint dimensions = 1; auto blockedCommandsData = createBlockedCommandsData(*pCmdQ); - DispatchInfo dispatchInfo(const_cast(&kernel), dimensions, workItems, workGroupSize, globalOffsets); + DispatchInfo dispatchInfo(pClDevice, const_cast(&kernel), dimensions, workItems, workGroupSize, globalOffsets); MultiDispatchInfo multiDispatchInfo(&kernel); multiDispatchInfo.push(dispatchInfo); HardwareInterface::dispatchWalker( @@ -767,7 +767,7 @@ HWTEST_F(DispatchWalkerTest, GivenBlockedQueueWhenDispatchingWalkerThenRequiredH MockKernel kernel(program.get(), kernelInfo); ASSERT_EQ(CL_SUCCESS, kernel.initialize()); - MockMultiDispatchInfo multiDispatchInfo(&kernel); + MockMultiDispatchInfo multiDispatchInfo(pClDevice, &kernel); auto blockedCommandsData = createBlockedCommandsData(*pCmdQ); @@ -794,7 +794,7 @@ HWTEST_F(DispatchWalkerTest, GivenBlockedQueueWhenDispatchingWalkerThenRequiredH HWTEST_F(DispatchWalkerTest, givenBlockedQueueWhenDispatchWalkerIsCalledThenCommandStreamHasGpuAddress) { MockKernel kernel(program.get(), kernelInfo); ASSERT_EQ(CL_SUCCESS, kernel.initialize()); - MockMultiDispatchInfo multiDispatchInfo(&kernel); + MockMultiDispatchInfo multiDispatchInfo(pClDevice, &kernel); auto blockedCommandsData = createBlockedCommandsData(*pCmdQ); HardwareInterface::dispatchWalker( @@ -815,7 +815,7 @@ HWTEST_F(DispatchWalkerTest, givenBlockedQueueWhenDispatchWalkerIsCalledThenComm HWTEST_F(DispatchWalkerTest, givenThereAreAllocationsForReuseWhenDispatchWalkerIsCalledThenCommandStreamObtainsReusableAllocation) { MockKernel kernel(program.get(), kernelInfo); ASSERT_EQ(CL_SUCCESS, kernel.initialize()); - MockMultiDispatchInfo multiDispatchInfo(&kernel); + MockMultiDispatchInfo multiDispatchInfo(pClDevice, &kernel); auto &csr = pCmdQ->getGpgpuCommandStreamReceiver(); auto allocation = csr.getMemoryManager()->allocateGraphicsMemoryWithProperties({csr.getRootDeviceIndex(), MemoryConstants::pageSize64k + CSRequirements::csOverfetchSize, @@ -845,7 +845,7 @@ HWTEST_F(DispatchWalkerTest, GivenMultipleKernelsWhenDispatchingWalkerThenWorkDi MockKernel kernel2(program.get(), kernelInfo); ASSERT_EQ(CL_SUCCESS, kernel2.initialize()); - MockMultiDispatchInfo multiDispatchInfo(std::vector({&kernel1, &kernel2})); + MockMultiDispatchInfo multiDispatchInfo(pClDevice, std::vector({&kernel1, &kernel2})); HardwareInterface::dispatchWalker( *pCmdQ, @@ -880,7 +880,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, DispatchWalkerTest, GivenMultipleKernelsWhenDispatch MockKernel kernel2(program.get(), kernelInfoWithSampler); ASSERT_EQ(CL_SUCCESS, kernel2.initialize()); - MockMultiDispatchInfo multiDispatchInfo(std::vector({&kernel1, &kernel2})); + MockMultiDispatchInfo multiDispatchInfo(pClDevice, std::vector({&kernel1, &kernel2})); // create Indirect DSH heap auto &indirectHeap = pCmdQ->getIndirectHeap(IndirectHeap::DYNAMIC_STATE, 8192); @@ -967,7 +967,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, DispatchWalkerTest, GivenMultipleKernelsWhenDispatch MockKernel kernel2(program.get(), kernelInfoWithSampler); ASSERT_EQ(CL_SUCCESS, kernel2.initialize()); - MockMultiDispatchInfo multiDispatchInfo(std::vector({&kernel1, &kernel2})); + MockMultiDispatchInfo multiDispatchInfo(pClDevice, std::vector({&kernel1, &kernel2})); // create commandStream auto &cmdStream = pCmdQ->getCS(0); @@ -1012,7 +1012,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, DispatchWalkerTest, GivenMultipleKernelsWhenDispatch MockKernel kernel2(program.get(), kernelInfoWithSampler); ASSERT_EQ(CL_SUCCESS, kernel2.initialize()); - MockMultiDispatchInfo multiDispatchInfo(std::vector({&kernel1, &kernel2})); + MockMultiDispatchInfo multiDispatchInfo(pClDevice, std::vector({&kernel1, &kernel2})); // create commandStream auto &cmdStream = pCmdQ->getCS(0); @@ -1059,8 +1059,8 @@ HWCMDTEST_F(IGFX_GEN8_CORE, DispatchWalkerTest, GivenMultipleDispatchInfoAndSame MockKernel kernel(program.get(), kernelInfo); ASSERT_EQ(CL_SUCCESS, kernel.initialize()); - DispatchInfo di1(&kernel, 1, {100, 1, 1}, {10, 1, 1}, {0, 0, 0}, {100, 1, 1}, {10, 1, 1}, {10, 1, 1}, {10, 1, 1}, {0, 0, 0}); - DispatchInfo di2(&kernel, 1, {100, 1, 1}, {10, 1, 1}, {0, 0, 0}, {100, 1, 1}, {10, 1, 1}, {10, 1, 1}, {10, 1, 1}, {10, 0, 0}); + DispatchInfo di1(pClDevice, &kernel, 1, {100, 1, 1}, {10, 1, 1}, {0, 0, 0}, {100, 1, 1}, {10, 1, 1}, {10, 1, 1}, {10, 1, 1}, {0, 0, 0}); + DispatchInfo di2(pClDevice, &kernel, 1, {100, 1, 1}, {10, 1, 1}, {0, 0, 0}, {100, 1, 1}, {10, 1, 1}, {10, 1, 1}, {10, 1, 1}, {10, 0, 0}); MockMultiDispatchInfo multiDispatchInfo(std::vector({&di1, &di2})); @@ -1115,7 +1115,7 @@ HWTEST_F(DispatchWalkerTest, GivenCacheFlushAfterWalkerDisabledWhenAllocationReq MockGraphicsAllocation cacheRequiringAllocation; kernel1.kernelArgRequiresCacheFlush[0] = &cacheRequiringAllocation; - MockMultiDispatchInfo multiDispatchInfo(std::vector({&kernel1})); + MockMultiDispatchInfo multiDispatchInfo(pClDevice, std::vector({&kernel1})); // create commandStream auto &cmdStream = pCmdQ->getCS(0); @@ -1153,7 +1153,7 @@ HWTEST_F(DispatchWalkerTest, GivenCacheFlushAfterWalkerEnabledWhenWalkerWithTwoK kernel1.kernelArgRequiresCacheFlush[0] = &cacheRequiringAllocation; kernel2.kernelArgRequiresCacheFlush[0] = &cacheRequiringAllocation; - MockMultiDispatchInfo multiDispatchInfo(std::vector({&kernel1, &kernel2})); + MockMultiDispatchInfo multiDispatchInfo(pClDevice, std::vector({&kernel1, &kernel2})); // create commandStream auto &cmdStream = pCmdQ->getCS(0); @@ -1191,8 +1191,8 @@ HWTEST_F(DispatchWalkerTest, GivenCacheFlushAfterWalkerEnabledWhenTwoWalkersForQ kernel1.kernelArgRequiresCacheFlush[0] = &cacheRequiringAllocation; kernel2.kernelArgRequiresCacheFlush[0] = &cacheRequiringAllocation; - MockMultiDispatchInfo multiDispatchInfo1(std::vector({&kernel1})); - MockMultiDispatchInfo multiDispatchInfo2(std::vector({&kernel2})); + MockMultiDispatchInfo multiDispatchInfo1(pClDevice, std::vector({&kernel1})); + MockMultiDispatchInfo multiDispatchInfo2(pClDevice, std::vector({&kernel2})); // create commandStream auto &cmdStream = pCmdQ->getCS(0); diff --git a/opencl/test/unit_test/command_queue/enqueue_command_without_kernel_tests.cpp b/opencl/test/unit_test/command_queue/enqueue_command_without_kernel_tests.cpp index c4bc48c4c1..70c777aef3 100644 --- a/opencl/test/unit_test/command_queue/enqueue_command_without_kernel_tests.cpp +++ b/opencl/test/unit_test/command_queue/enqueue_command_without_kernel_tests.cpp @@ -335,7 +335,7 @@ HWTEST_F(DispatchFlagsTests, givenMockKernelWhenSettingAdditionalKernelExecInfoT auto blockedCommandsData = std::make_unique(cmdStream, *mockCmdQ->getGpgpuCommandStreamReceiver().getInternalAllocationStorage()); MockKernelWithInternals mockKernelWithInternals(*device.get()); auto pKernel = mockKernelWithInternals.mockKernel; - MockMultiDispatchInfo multiDispatchInfo(pKernel); + MockMultiDispatchInfo multiDispatchInfo(device.get(), pKernel); std::unique_ptr printfHandler(PrintfHandler::create(multiDispatchInfo, *device.get())); IndirectHeap *dsh = nullptr, *ioh = nullptr, *ssh = nullptr; diff --git a/opencl/test/unit_test/command_queue/enqueue_copy_buffer_to_image_tests.cpp b/opencl/test/unit_test/command_queue/enqueue_copy_buffer_to_image_tests.cpp index 6d426e7ff7..75f9e567b0 100644 --- a/opencl/test/unit_test/command_queue/enqueue_copy_buffer_to_image_tests.cpp +++ b/opencl/test/unit_test/command_queue/enqueue_copy_buffer_to_image_tests.cpp @@ -208,7 +208,7 @@ HWTEST_P(MipMapCopyBufferToImageTest, GivenImageWithMipLevelNonZeroWhenCopyBuffe EBuiltInOps::CopyBufferToImage3d, pCmdQ->getContext(), pCmdQ->getDevice(), - std::unique_ptr(new MockBuiltinDispatchInfoBuilder(*builtIns, &origBuilder))); + std::unique_ptr(new MockBuiltinDispatchInfoBuilder(*builtIns, pCmdQ->getClDevice(), &origBuilder))); cl_int retVal = CL_SUCCESS; cl_image_desc imageDesc = {}; diff --git a/opencl/test/unit_test/command_queue/enqueue_copy_image_tests.cpp b/opencl/test/unit_test/command_queue/enqueue_copy_image_tests.cpp index e6cc14ca06..8c37586c37 100644 --- a/opencl/test/unit_test/command_queue/enqueue_copy_image_tests.cpp +++ b/opencl/test/unit_test/command_queue/enqueue_copy_image_tests.cpp @@ -216,7 +216,7 @@ HWTEST_P(MipMapCopyImageTest, GivenImagesWithNonZeroMipLevelsWhenCopyImageIsCall EBuiltInOps::CopyImageToImage3d, pCmdQ->getContext(), pCmdQ->getDevice(), - std::unique_ptr(new MockBuiltinDispatchInfoBuilder(*builtIns, &origBuilder))); + std::unique_ptr(new MockBuiltinDispatchInfoBuilder(*builtIns, pCmdQ->getClDevice(), &origBuilder))); cl_int retVal = CL_SUCCESS; cl_image_desc srcImageDesc = {}; diff --git a/opencl/test/unit_test/command_queue/enqueue_copy_image_to_buffer_tests.cpp b/opencl/test/unit_test/command_queue/enqueue_copy_image_to_buffer_tests.cpp index a97b990d30..6a9e7ca630 100644 --- a/opencl/test/unit_test/command_queue/enqueue_copy_image_to_buffer_tests.cpp +++ b/opencl/test/unit_test/command_queue/enqueue_copy_image_to_buffer_tests.cpp @@ -209,7 +209,7 @@ HWTEST_P(MipMapCopyImageToBufferTest, GivenImageWithMipLevelNonZeroWhenCopyImage EBuiltInOps::CopyImage3dToBuffer, pCmdQ->getContext(), pCmdQ->getDevice(), - std::unique_ptr(new MockBuiltinDispatchInfoBuilder(*builtIns, &origBuilder))); + std::unique_ptr(new MockBuiltinDispatchInfoBuilder(*builtIns, pCmdQ->getClDevice(), &origBuilder))); cl_int retVal = CL_SUCCESS; cl_image_desc imageDesc = {}; diff --git a/opencl/test/unit_test/command_queue/enqueue_handler_tests.cpp b/opencl/test/unit_test/command_queue/enqueue_handler_tests.cpp index a0b701a7cd..0047af8e33 100644 --- a/opencl/test/unit_test/command_queue/enqueue_handler_tests.cpp +++ b/opencl/test/unit_test/command_queue/enqueue_handler_tests.cpp @@ -73,7 +73,7 @@ HWTEST_F(EnqueueHandlerTest, givenEnqueueHandlerWithKernelSplitWhenAubCsrIsActiv kernel2.kernelInfo.kernelDescriptor.kernelMetadata.kernelName = "kernel_2"; auto mockCmdQ = std::unique_ptr>(new MockCommandQueueHw(context, pClDevice, 0)); - MockMultiDispatchInfo multiDispatchInfo(std::vector({kernel1.mockKernel, kernel2.mockKernel})); + MockMultiDispatchInfo multiDispatchInfo(pClDevice, std::vector({kernel1.mockKernel, kernel2.mockKernel})); mockCmdQ->template enqueueHandler(nullptr, 0, true, multiDispatchInfo, 0, nullptr, nullptr); @@ -297,7 +297,7 @@ HWTEST_F(EnqueueHandlerTest, WhenEnqueuingBlockedWithoutReturnEventThenVirtualEv Kernel *kernel = kernelInternals.mockKernel; - MockMultiDispatchInfo multiDispatchInfo(kernel); + MockMultiDispatchInfo multiDispatchInfo(pClDevice, kernel); auto mockCmdQ = new MockCommandQueueHw(context, pClDevice, 0); @@ -331,7 +331,7 @@ HWTEST_F(EnqueueHandlerTest, WhenEnqueuingBlockedThenVirtualEventIsSetAsCurrentC Kernel *kernel = kernelInternals.mockKernel; - MockMultiDispatchInfo multiDispatchInfo(kernel); + MockMultiDispatchInfo multiDispatchInfo(pClDevice, kernel); auto mockCmdQ = new MockCommandQueueHw(context, pClDevice, 0); @@ -357,7 +357,7 @@ HWTEST_F(EnqueueHandlerTest, WhenEnqueuingBlockedThenVirtualEventIsSetAsCurrentC HWTEST_F(EnqueueHandlerTest, WhenEnqueuingWithOutputEventThenEventIsRegistered) { MockKernelWithInternals kernelInternals(*pClDevice, context); Kernel *kernel = kernelInternals.mockKernel; - MockMultiDispatchInfo multiDispatchInfo(kernel); + MockMultiDispatchInfo multiDispatchInfo(pClDevice, kernel); cl_event outputEvent = nullptr; auto mockCmdQ = new MockCommandQueueHw(context, pClDevice, 0); @@ -460,7 +460,7 @@ HWTEST_F(EnqueueHandlerTest, givenEnqueueHandlerWhenSubCaptureIsOffThenActivateS MockKernelWithInternals kernelInternals(*pClDevice, context); Kernel *kernel = kernelInternals.mockKernel; - MockMultiDispatchInfo multiDispatchInfo(kernel); + MockMultiDispatchInfo multiDispatchInfo(pClDevice, kernel); auto mockCmdQ = new MockCommandQueueHw(context, pClDevice, 0); @@ -482,7 +482,7 @@ HWTEST_F(EnqueueHandlerTest, givenEnqueueHandlerWhenSubCaptureIsOnThenActivateSu MockKernelWithInternals kernelInternals(*pClDevice, context); Kernel *kernel = kernelInternals.mockKernel; - MockMultiDispatchInfo multiDispatchInfo(kernel); + MockMultiDispatchInfo multiDispatchInfo(pClDevice, kernel); auto mockCmdQ = new MockCommandQueueHw(context, pClDevice, 0); @@ -505,7 +505,7 @@ HWTEST_F(EnqueueHandlerTest, givenEnqueueHandlerWhenClSetKernelExecInfoAlreadyse MockKernelWithInternals kernelInternals(*pClDevice, context); Kernel *kernel = kernelInternals.mockKernel; - MockMultiDispatchInfo multiDispatchInfo(kernel); + MockMultiDispatchInfo multiDispatchInfo(pClDevice, kernel); uint32_t euThreadSetting = CL_KERNEL_EXEC_INFO_THREAD_ARBITRATION_POLICY_ROUND_ROBIN_INTEL; size_t ptrSizeInBytes = 1 * sizeof(uint32_t *); @@ -625,7 +625,7 @@ HWTEST_F(EnqueueHandlerTestBasic, givenEnqueueHandlerWhenCommandIsBlokingThenCom auto mockCmdQ = setupFixtureAndCreateMockCommandQueue(); MockKernelWithInternals kernelInternals(*device, context.get()); Kernel *kernel = kernelInternals.mockKernel; - MockMultiDispatchInfo multiDispatchInfo(kernel); + MockMultiDispatchInfo multiDispatchInfo(device.get(), kernel); mockCmdQ->template enqueueHandler(nullptr, 0, true, @@ -641,7 +641,7 @@ HWTEST_F(EnqueueHandlerTestBasic, givenBlockedEnqueueHandlerWhenCommandIsBloking MockKernelWithInternals kernelInternals(*device, context.get()); Kernel *kernel = kernelInternals.mockKernel; - MockMultiDispatchInfo multiDispatchInfo(kernel); + MockMultiDispatchInfo multiDispatchInfo(device.get(), kernel); UserEvent userEvent; cl_event waitlist[] = {&userEvent}; diff --git a/opencl/test/unit_test/command_queue/enqueue_kernel_1_tests.cpp b/opencl/test/unit_test/command_queue/enqueue_kernel_1_tests.cpp index 52a9f64ca8..b2621933e6 100644 --- a/opencl/test/unit_test/command_queue/enqueue_kernel_1_tests.cpp +++ b/opencl/test/unit_test/command_queue/enqueue_kernel_1_tests.cpp @@ -395,9 +395,7 @@ HWTEST_F(EnqueueKernelTest, addsIndirectData) { TEST_F(EnqueueKernelTest, GivenKernelWithBuiltinDispatchInfoBuilderWhenBeingDispatchedThenBuiltinDispatcherIsUsedForDispatchValidation) { struct MockBuiltinDispatchBuilder : BuiltinDispatchInfoBuilder { - MockBuiltinDispatchBuilder(BuiltIns &builtins) - : BuiltinDispatchInfoBuilder(builtins) { - } + using BuiltinDispatchInfoBuilder::BuiltinDispatchInfoBuilder; cl_int validateDispatch(Kernel *kernel, uint32_t inworkDim, const Vec3 &gws, const Vec3 &elws, const Vec3 &offset) const override { @@ -422,7 +420,7 @@ TEST_F(EnqueueKernelTest, GivenKernelWithBuiltinDispatchInfoBuilderWhenBeingDisp mutable bool wasValidateDispatchCalled = false; }; - MockBuiltinDispatchBuilder mockNuiltinDispatchBuilder(*pCmdQ->getDevice().getBuiltIns()); + MockBuiltinDispatchBuilder mockNuiltinDispatchBuilder(*pCmdQ->getDevice().getBuiltIns(), pCmdQ->getClDevice()); MockKernelWithInternals mockKernel(*pClDevice); mockKernel.kernelInfo.builtinDispatchBuilder = &mockNuiltinDispatchBuilder; diff --git a/opencl/test/unit_test/command_queue/enqueue_read_image_tests.cpp b/opencl/test/unit_test/command_queue/enqueue_read_image_tests.cpp index 39ec68e2e4..36a919d740 100644 --- a/opencl/test/unit_test/command_queue/enqueue_read_image_tests.cpp +++ b/opencl/test/unit_test/command_queue/enqueue_read_image_tests.cpp @@ -258,7 +258,7 @@ HWTEST_F(EnqueueReadImageTest, GivenImage1DarrayWhenReadImageIsCalledThenRowPitc copyBuiltIn, pCmdQ->getContext(), pCmdQ->getDevice(), - std::unique_ptr(new MockBuiltinDispatchInfoBuilder(*builtIns, &origBuilder))); + std::unique_ptr(new MockBuiltinDispatchInfoBuilder(*builtIns, pCmdQ->getClDevice(), &origBuilder))); auto srcImage = Image1dArrayHelper<>::create(context); auto imageDesc = srcImage->getImageDesc(); @@ -541,7 +541,7 @@ HWTEST_P(MipMapReadImageTest, GivenImageWithMipLevelNonZeroWhenReadImageIsCalled EBuiltInOps::CopyImage3dToBuffer, pCmdQ->getContext(), pCmdQ->getDevice(), - std::unique_ptr(new MockBuiltinDispatchInfoBuilder(*builtIns, &origBuilder))); + std::unique_ptr(new MockBuiltinDispatchInfoBuilder(*builtIns, pCmdQ->getClDevice(), &origBuilder))); cl_int retVal = CL_SUCCESS; cl_image_desc imageDesc = {}; diff --git a/opencl/test/unit_test/command_queue/enqueue_svm_mem_copy_tests.cpp b/opencl/test/unit_test/command_queue/enqueue_svm_mem_copy_tests.cpp index 85958e5a78..39171b20bb 100644 --- a/opencl/test/unit_test/command_queue/enqueue_svm_mem_copy_tests.cpp +++ b/opencl/test/unit_test/command_queue/enqueue_svm_mem_copy_tests.cpp @@ -85,7 +85,7 @@ HWTEST_F(EnqueueSvmMemCopyTest, givenEnqueueSVMMemcpyWhenUsingCopyBufferToBuffer EBuiltInOps::CopyBufferToBuffer, pCmdQ->getContext(), pCmdQ->getDevice(), - std::unique_ptr(new MockBuiltinDispatchInfoBuilder(*builtIns, &origBuilder))); + std::unique_ptr(new MockBuiltinDispatchInfoBuilder(*builtIns, pCmdQ->getClDevice(), &origBuilder))); EXPECT_EQ(&origBuilder, oldBuilder.get()); // call enqueue on mock builder @@ -162,7 +162,7 @@ HWTEST_F(EnqueueSvmMemCopyTest, givenEnqueueSVMMemcpyWhenUsingCopyBufferToBuffer EBuiltInOps::CopyBufferToBuffer, pCmdQ->getContext(), pCmdQ->getDevice(), - std::unique_ptr(new MockBuiltinDispatchInfoBuilder(*builtIns, &origBuilder))); + std::unique_ptr(new MockBuiltinDispatchInfoBuilder(*builtIns, pCmdQ->getClDevice(), &origBuilder))); EXPECT_EQ(&origBuilder, oldBuilder.get()); // call enqueue on mock builder @@ -244,7 +244,7 @@ HWTEST_F(EnqueueSvmMemCopyTest, givenEnqueueSVMMemcpyWhenUsingCopyBufferToBuffer EBuiltInOps::CopyBufferToBuffer, pCmdQ->getContext(), pCmdQ->getDevice(), - std::unique_ptr(new MockBuiltinDispatchInfoBuilder(*builtIns, &origBuilder))); + std::unique_ptr(new MockBuiltinDispatchInfoBuilder(*builtIns, pCmdQ->getClDevice(), &origBuilder))); EXPECT_EQ(&origBuilder, oldBuilder.get()); // call enqueue on mock builder diff --git a/opencl/test/unit_test/command_queue/enqueue_svm_mem_fill_tests.cpp b/opencl/test/unit_test/command_queue/enqueue_svm_mem_fill_tests.cpp index 2a93419dfb..ac292ab1a1 100644 --- a/opencl/test/unit_test/command_queue/enqueue_svm_mem_fill_tests.cpp +++ b/opencl/test/unit_test/command_queue/enqueue_svm_mem_fill_tests.cpp @@ -59,8 +59,8 @@ struct EnqueueSvmMemFillTest : public ClDeviceFixture, HWTEST_P(EnqueueSvmMemFillTest, givenEnqueueSVMMemFillWhenUsingFillBufferBuilderThenItIsConfiguredWithBuitinOpParamsAndProducesDispatchInfo) { struct MockFillBufferBuilder : MockBuiltinDispatchInfoBuilder { - MockFillBufferBuilder(BuiltIns &kernelLib, BuiltinDispatchInfoBuilder *origBuilder, const void *pattern, size_t patternSize) - : MockBuiltinDispatchInfoBuilder(kernelLib, origBuilder), + MockFillBufferBuilder(BuiltIns &kernelLib, ClDevice &clDevice, BuiltinDispatchInfoBuilder *origBuilder, const void *pattern, size_t patternSize) + : MockBuiltinDispatchInfoBuilder(kernelLib, clDevice, origBuilder), pattern(pattern), patternSize(patternSize) { } void validateInput(const BuiltinOpParams &conf) const override { @@ -86,7 +86,7 @@ HWTEST_P(EnqueueSvmMemFillTest, givenEnqueueSVMMemFillWhenUsingFillBufferBuilder EBuiltInOps::FillBuffer, pCmdQ->getContext(), pCmdQ->getDevice(), - std::unique_ptr(new MockFillBufferBuilder(*builtIns, &origBuilder, pattern, patternSize))); + std::unique_ptr(new MockFillBufferBuilder(*builtIns, pCmdQ->getClDevice(), &origBuilder, pattern, patternSize))); EXPECT_EQ(&origBuilder, oldBuilder.get()); // call enqueue on mock builder diff --git a/opencl/test/unit_test/command_queue/enqueue_write_image_tests.cpp b/opencl/test/unit_test/command_queue/enqueue_write_image_tests.cpp index 19c8db3b8e..12c7680dd1 100644 --- a/opencl/test/unit_test/command_queue/enqueue_write_image_tests.cpp +++ b/opencl/test/unit_test/command_queue/enqueue_write_image_tests.cpp @@ -276,7 +276,7 @@ HWTEST_F(EnqueueWriteImageTest, GivenImage1DarrayWhenWriteImageIsCalledThenRowPi copyBuiltIn, pCmdQ->getContext(), pCmdQ->getDevice(), - std::unique_ptr(new MockBuiltinDispatchInfoBuilder(*builtIns, &origBuilder))); + std::unique_ptr(new MockBuiltinDispatchInfoBuilder(*builtIns, pCmdQ->getClDevice(), &origBuilder))); std::unique_ptr image; auto destImage = Image1dArrayHelper<>::create(context); @@ -471,7 +471,7 @@ HWTEST_P(MipMapWriteImageTest, GivenImageWithMipLevelNonZeroWhenReadImageIsCalle EBuiltInOps::CopyBufferToImage3d, pCmdQ->getContext(), pCmdQ->getDevice(), - std::unique_ptr(new MockBuiltinDispatchInfoBuilder(*builtIns, &origBuilder))); + std::unique_ptr(new MockBuiltinDispatchInfoBuilder(*builtIns, pCmdQ->getClDevice(), &origBuilder))); cl_int retVal = CL_SUCCESS; cl_image_desc imageDesc = {}; diff --git a/opencl/test/unit_test/command_queue/local_work_size_tests.cpp b/opencl/test/unit_test/command_queue/local_work_size_tests.cpp index 3685c94625..629e66641e 100644 --- a/opencl/test/unit_test/command_queue/local_work_size_tests.cpp +++ b/opencl/test/unit_test/command_queue/local_work_size_tests.cpp @@ -673,6 +673,7 @@ TEST(localWorkSizeTest, givenDispatchInfoWhenWorkSizeInfoIsCreatedThenItHasCorre MockClDevice device{new MockDevice}; MockKernelWithInternals kernel(device); DispatchInfo dispatchInfo; + dispatchInfo.setClDevice(&device); dispatchInfo.setKernel(kernel.mockKernel); auto threadsPerEu = defaultHwInfo->gtSystemInfo.ThreadCount / defaultHwInfo->gtSystemInfo.EUCount; @@ -690,6 +691,7 @@ TEST(localWorkSizeTest, givenDispatchInfoWhenWorkSizeInfoIsCreatedThenHasBarrier MockClDevice device{new MockDevice}; MockKernelWithInternals kernel(device); DispatchInfo dispatchInfo; + dispatchInfo.setClDevice(&device); dispatchInfo.setKernel(kernel.mockKernel); kernel.kernelInfo.patchInfo.executionEnvironment = nullptr; diff --git a/opencl/test/unit_test/command_queue/multi_dispatch_info_tests.cpp b/opencl/test/unit_test/command_queue/multi_dispatch_info_tests.cpp index 4ae3dd6b8b..ead9a48830 100644 --- a/opencl/test/unit_test/command_queue/multi_dispatch_info_tests.cpp +++ b/opencl/test/unit_test/command_queue/multi_dispatch_info_tests.cpp @@ -21,7 +21,7 @@ struct MultiDispatchInfoTest : public ::testing::Test { TEST_F(MultiDispatchInfoTest, GivenNullKernelWhenCreatingMultiDispatchInfoThenExpectationsAreMet) { - MockMultiDispatchInfo multiDispatchInfo(nullptr); + MockMultiDispatchInfo multiDispatchInfo(nullptr, nullptr); EXPECT_FALSE(multiDispatchInfo.begin()->usesSlm()); EXPECT_FALSE(multiDispatchInfo.begin()->usesStatelessPrintfSurface()); diff --git a/opencl/test/unit_test/command_stream/aub_command_stream_receiver_1_tests.cpp b/opencl/test/unit_test/command_stream/aub_command_stream_receiver_1_tests.cpp index ae17ae8ccd..ab6e2895ea 100644 --- a/opencl/test/unit_test/command_stream/aub_command_stream_receiver_1_tests.cpp +++ b/opencl/test/unit_test/command_stream/aub_command_stream_receiver_1_tests.cpp @@ -897,7 +897,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInSubCaptur MockKernelWithInternals kernelInternals(*pClDevice); kernelInternals.kernelInfo.kernelDescriptor.kernelMetadata.kernelName = "kernelName"; Kernel *kernel = kernelInternals.mockKernel; - MockMultiDispatchInfo multiDispatchInfo(kernel); + MockMultiDispatchInfo multiDispatchInfo(pClDevice, kernel); ASSERT_FALSE(aubCsr->isFileOpen()); @@ -918,7 +918,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInSubCaptur aubCsr->subCaptureManager = std::unique_ptr(subCaptureManagerMock); MockKernelWithInternals kernelInternals(*pClDevice); - MockMultiDispatchInfo multiDispatchInfo(kernelInternals.mockKernel); + MockMultiDispatchInfo multiDispatchInfo(pClDevice, kernelInternals.mockKernel); std::string fileName = aubCsr->subCaptureManager->getSubCaptureFileName(kernelInternals.kernelInfo.kernelDescriptor.kernelMetadata.kernelName); aubCsr->initFile(fileName); @@ -945,7 +945,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInSubCaptur MockKernelWithInternals kernelInternals(*pClDevice); kernelInternals.kernelInfo.kernelDescriptor.kernelMetadata.kernelName = "kernelName"; - MockMultiDispatchInfo multiDispatchInfo(kernelInternals.mockKernel); + MockMultiDispatchInfo multiDispatchInfo(pClDevice, kernelInternals.mockKernel); std::string fileName = "file_name.aub"; aubCsr->initFile(fileName); @@ -974,7 +974,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInSubCaptur MockKernelWithInternals kernelInternals(*pClDevice); kernelInternals.kernelInfo.kernelDescriptor.kernelMetadata.kernelName = "kernelName"; - MockMultiDispatchInfo multiDispatchInfo(kernelInternals.mockKernel); + MockMultiDispatchInfo multiDispatchInfo(pClDevice, kernelInternals.mockKernel); std::string fileName = "file_name.aub"; aubCsr->initFile(fileName); @@ -1001,7 +1001,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInSubCaptur MockKernelWithInternals kernelInternals(*pClDevice); kernelInternals.kernelInfo.kernelDescriptor.kernelMetadata.kernelName = "kernelName"; - MockMultiDispatchInfo multiDispatchInfo(kernelInternals.mockKernel); + MockMultiDispatchInfo multiDispatchInfo(pClDevice, kernelInternals.mockKernel); aubCsr->checkAndActivateAubSubCapture(multiDispatchInfo); @@ -1020,7 +1020,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInSubCaptur aubCsr->subCaptureManager = std::unique_ptr(subCaptureManagerMock); MockKernelWithInternals kernelInternals(*pClDevice); - MockMultiDispatchInfo multiDispatchInfo(kernelInternals.mockKernel); + MockMultiDispatchInfo multiDispatchInfo(pClDevice, kernelInternals.mockKernel); aubCsr->initFile(aubCsr->subCaptureManager->getSubCaptureFileName(kernelInternals.kernelInfo.kernelDescriptor.kernelMetadata.kernelName)); aubCsr->checkAndActivateAubSubCapture(multiDispatchInfo); @@ -1042,7 +1042,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInSubCaptur MockKernelWithInternals kernelInternals(*pClDevice); kernelInternals.kernelInfo.kernelDescriptor.kernelMetadata.kernelName = "kernelName"; Kernel *kernel = kernelInternals.mockKernel; - MockMultiDispatchInfo multiDispatchInfo(kernel); + MockMultiDispatchInfo multiDispatchInfo(pClDevice, kernel); aubCsr->checkAndActivateAubSubCapture(multiDispatchInfo); @@ -1062,7 +1062,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInSubCaptur MockKernelWithInternals kernelInternals(*pClDevice); kernelInternals.kernelInfo.kernelDescriptor.kernelMetadata.kernelName = "kernelName"; - MockMultiDispatchInfo multiDispatchInfo(kernelInternals.mockKernel); + MockMultiDispatchInfo multiDispatchInfo(pClDevice, kernelInternals.mockKernel); aubCsr->checkAndActivateAubSubCapture(multiDispatchInfo); @@ -1081,7 +1081,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInStandalon aubCsr->subCaptureManager = std::unique_ptr(subCaptureManagerMock); MockKernelWithInternals kernelInternals(*pClDevice); - MockMultiDispatchInfo multiDispatchInfo(kernelInternals.mockKernel); + MockMultiDispatchInfo multiDispatchInfo(pClDevice, kernelInternals.mockKernel); aubCsr->checkAndActivateAubSubCapture(multiDispatchInfo); @@ -1101,7 +1101,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInStandalon aubCsr->subCaptureManager = std::unique_ptr(subCaptureManagerMock); MockKernelWithInternals kernelInternals(*pClDevice); - MockMultiDispatchInfo multiDispatchInfo(kernelInternals.mockKernel); + MockMultiDispatchInfo multiDispatchInfo(pClDevice, kernelInternals.mockKernel); aubCsr->checkAndActivateAubSubCapture(multiDispatchInfo); @@ -1122,7 +1122,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInStandalon MockKernelWithInternals kernelInternals(*pClDevice); kernelInternals.kernelInfo.kernelDescriptor.kernelMetadata.kernelName = "kernelName"; - MockMultiDispatchInfo multiDispatchInfo(kernelInternals.mockKernel); + MockMultiDispatchInfo multiDispatchInfo(pClDevice, kernelInternals.mockKernel); aubCsr->checkAndActivateAubSubCapture(multiDispatchInfo); @@ -1143,7 +1143,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInStandalon MockKernelWithInternals kernelInternals(*pClDevice); kernelInternals.kernelInfo.kernelDescriptor.kernelMetadata.kernelName = "kernelName"; - MockMultiDispatchInfo multiDispatchInfo(kernelInternals.mockKernel); + MockMultiDispatchInfo multiDispatchInfo(pClDevice, kernelInternals.mockKernel); aubCsr->checkAndActivateAubSubCapture(multiDispatchInfo); diff --git a/opencl/test/unit_test/command_stream/tbx_command_stream_tests.cpp b/opencl/test/unit_test/command_stream/tbx_command_stream_tests.cpp index 7d61a5ea2a..14400e550e 100644 --- a/opencl/test/unit_test/command_stream/tbx_command_stream_tests.cpp +++ b/opencl/test/unit_test/command_stream/tbx_command_stream_tests.cpp @@ -863,7 +863,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCsrInSubCaptureModeWhenCheckAndActivateA MockKernelWithInternals kernelInternals(*pClDevice); Kernel *kernel = kernelInternals.mockKernel; - MockMultiDispatchInfo multiDispatchInfo(kernel); + MockMultiDispatchInfo multiDispatchInfo(pClDevice, kernel); EXPECT_FALSE(tbxCsr.dumpTbxNonWritable); @@ -889,7 +889,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCsrInSubCaptureModeWhenCheckAndActivateA MockKernelWithInternals kernelInternals(*pClDevice); kernelInternals.kernelInfo.kernelDescriptor.kernelMetadata.kernelName = "kernelName"; Kernel *kernel = kernelInternals.mockKernel; - MockMultiDispatchInfo multiDispatchInfo(kernel); + MockMultiDispatchInfo multiDispatchInfo(pClDevice, kernel); EXPECT_FALSE(tbxCsr.dumpTbxNonWritable); @@ -915,7 +915,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCsrInSubCaptureModeWhenCheckAndActivateA MockKernelWithInternals kernelInternals(*pClDevice); kernelInternals.kernelInfo.kernelDescriptor.kernelMetadata.kernelName = "kernelName"; Kernel *kernel = kernelInternals.mockKernel; - MockMultiDispatchInfo multiDispatchInfo(kernel); + MockMultiDispatchInfo multiDispatchInfo(pClDevice, kernel); EXPECT_FALSE(tbxCsr.dumpTbxNonWritable); 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 ae5ddef55b..fdb3d325d0 100644 --- a/opencl/test/unit_test/context/driver_diagnostics_enqueue_tests.cpp +++ b/opencl/test/unit_test/context/driver_diagnostics_enqueue_tests.cpp @@ -751,7 +751,7 @@ TEST_P(PerformanceHintEnqueueKernelBadSizeTest, GivenBadLocalWorkGroupSizeWhenEn int badSizeDimension; uint32_t workDim = globalWorkGroupSize[1] == 1 ? 1 : globalWorkGroupSize[2] == 1 ? 2 : 3; - DispatchInfo dispatchInfo(kernel, workDim, Vec3(globalWorkGroupSize), Vec3(0u, 0u, 0u), Vec3(0u, 0u, 0u)); + DispatchInfo dispatchInfo(&pCmdQ->getClDevice(), kernel, workDim, Vec3(globalWorkGroupSize), Vec3(0u, 0u, 0u), Vec3(0u, 0u, 0u)); auto computedLocalWorkgroupSize = computeWorkgroupSize(dispatchInfo); diff --git a/opencl/test/unit_test/context/driver_diagnostics_tests.cpp b/opencl/test/unit_test/context/driver_diagnostics_tests.cpp index fefedfe6e6..fe41578b05 100644 --- a/opencl/test/unit_test/context/driver_diagnostics_tests.cpp +++ b/opencl/test/unit_test/context/driver_diagnostics_tests.cpp @@ -245,7 +245,7 @@ TEST_F(PerformanceHintTest, GivenNullContextAndInvalidDispatchinfoAndEnableCompu auto pDevice = castToObject(devices[0]); MockKernelWithInternals mockKernel(*pDevice, context); - DispatchInfo invalidDispatchInfo(mockKernel, 100, {32, 32, 32}, {1, 1, 1}, {0, 0, 0}); + DispatchInfo invalidDispatchInfo(pDevice, mockKernel, 100, {32, 32, 32}, {1, 1, 1}, {0, 0, 0}); provideLocalWorkGroupSizeHints(context, invalidDispatchInfo); } TEST_F(PerformanceHintTest, GivenNullContextAndInvalidDispatchinfoAndEnableComputeWorkSizeNDIsTrueWhenProvideLocalWorkGroupSizeIsCalledThenItDoesntCrash) { @@ -254,7 +254,7 @@ TEST_F(PerformanceHintTest, GivenNullContextAndInvalidDispatchinfoAndEnableCompu DebugManager.flags.EnableComputeWorkSizeND.set(true); auto pDevice = castToObject(devices[0]); MockKernelWithInternals mockKernel(*pDevice, context); - DispatchInfo invalidDispatchInfo(mockKernel, 100, {32, 32, 32}, {1, 1, 1}, {0, 0, 0}); + DispatchInfo invalidDispatchInfo(pDevice, mockKernel, 100, {32, 32, 32}, {1, 1, 1}, {0, 0, 0}); provideLocalWorkGroupSizeHints(context, invalidDispatchInfo); DebugManager.flags.EnableComputeWorkSizeND.set(isWorkGroupSizeEnabled); } @@ -264,7 +264,7 @@ TEST_F(PerformanceHintTest, GivenNullContextAndInvalidDispatchinfoAndEnableCompu DebugManager.flags.EnableComputeWorkSizeND.set(false); auto pDevice = castToObject(devices[0]); MockKernelWithInternals mockKernel(*pDevice, context); - DispatchInfo invalidDispatchInfo(mockKernel, 100, {32, 32, 32}, {1, 1, 1}, {0, 0, 0}); + DispatchInfo invalidDispatchInfo(pDevice, mockKernel, 100, {32, 32, 32}, {1, 1, 1}, {0, 0, 0}); provideLocalWorkGroupSizeHints(context, invalidDispatchInfo); DebugManager.flags.EnableComputeWorkSizeND.set(isWorkGroupSizeEnabled); } @@ -273,7 +273,7 @@ TEST_F(PerformanceHintTest, GivenNullContextAndInvalidDispatchinfoAndEnableCompu auto pDevice = castToObject(devices[0]); MockKernelWithInternals mockKernel(*pDevice, context); - DispatchInfo invalidDispatchInfo(mockKernel, 100, {32, 32, 32}, {1, 1, 1}, {0, 0, 0}); + DispatchInfo invalidDispatchInfo(pDevice, mockKernel, 100, {32, 32, 32}, {1, 1, 1}, {0, 0, 0}); provideLocalWorkGroupSizeHints(context, invalidDispatchInfo); } TEST_F(PerformanceHintTest, GivenNullContextAndInvalidDispatchinfoAndEnableComputeWorkSizeSquaredIsTrueWhenProvideLocalWorkGroupSizeIsCalledThenItDoesntCrash) { @@ -283,7 +283,7 @@ TEST_F(PerformanceHintTest, GivenNullContextAndInvalidDispatchinfoAndEnableCompu DebugManager.flags.EnableComputeWorkSizeND.set(false); auto pDevice = castToObject(devices[0]); MockKernelWithInternals mockKernel(*pDevice, context); - DispatchInfo invalidDispatchInfo(mockKernel, 100, {32, 32, 32}, {1, 1, 1}, {0, 0, 0}); + DispatchInfo invalidDispatchInfo(pDevice, mockKernel, 100, {32, 32, 32}, {1, 1, 1}, {0, 0, 0}); provideLocalWorkGroupSizeHints(context, invalidDispatchInfo); } TEST_F(PerformanceHintTest, GivenNullContextAndInvalidDispatchinfoAndEnableComputeWorkSizeSquaredIsFalseWhenProvideLocalWorkGroupSizeIsCalledThenItDoesntCrash) { @@ -293,7 +293,7 @@ TEST_F(PerformanceHintTest, GivenNullContextAndInvalidDispatchinfoAndEnableCompu DebugManager.flags.EnableComputeWorkSizeND.set(false); auto pDevice = castToObject(devices[0]); MockKernelWithInternals mockKernel(*pDevice, context); - DispatchInfo invalidDispatchInfo(mockKernel, 100, {32, 32, 32}, {1, 1, 1}, {0, 0, 0}); + DispatchInfo invalidDispatchInfo(pDevice, mockKernel, 100, {32, 32, 32}, {1, 1, 1}, {0, 0, 0}); provideLocalWorkGroupSizeHints(context, invalidDispatchInfo); } @@ -301,7 +301,7 @@ TEST_F(PerformanceHintTest, GivenContextAndDispatchinfoAndEnableComputeWorkSizeS auto pDevice = castToObject(devices[0]); MockKernelWithInternals mockKernel(*pDevice, context); - DispatchInfo invalidDispatchInfo(mockKernel, 100, {32, 32, 32}, {1, 1, 1}, {0, 0, 0}); + DispatchInfo invalidDispatchInfo(pDevice, mockKernel, 100, {32, 32, 32}, {1, 1, 1}, {0, 0, 0}); provideLocalWorkGroupSizeHints(context, invalidDispatchInfo); } TEST_F(PerformanceHintTest, GivenContextAndDispatchinfoAndEnableComputeWorkSizeSquaredIsTrueWhenProvideLocalWorkGroupSizeIsCalledReturnValue) { @@ -311,7 +311,7 @@ TEST_F(PerformanceHintTest, GivenContextAndDispatchinfoAndEnableComputeWorkSizeS DebugManager.flags.EnableComputeWorkSizeND.set(false); auto pDevice = castToObject(devices[0]); MockKernelWithInternals mockKernel(*pDevice, context); - DispatchInfo invalidDispatchInfo(mockKernel, 2, {32, 32, 1}, {1, 1, 1}, {0, 0, 0}); + DispatchInfo invalidDispatchInfo(pDevice, mockKernel, 2, {32, 32, 1}, {1, 1, 1}, {0, 0, 0}); provideLocalWorkGroupSizeHints(context, invalidDispatchInfo); } TEST_F(PerformanceHintTest, GivenContextAndDispatchinfoAndEnableComputeWorkSizeSquaredIsFalseWhenProvideLocalWorkGroupSizeIsCalledReturnValue) { @@ -321,7 +321,7 @@ TEST_F(PerformanceHintTest, GivenContextAndDispatchinfoAndEnableComputeWorkSizeS DebugManager.flags.EnableComputeWorkSizeND.set(false); auto pDevice = castToObject(devices[0]); MockKernelWithInternals mockKernel(*pDevice, context); - DispatchInfo invalidDispatchInfo(mockKernel, 2, {32, 32, 1}, {1, 1, 1}, {0, 0, 0}); + DispatchInfo invalidDispatchInfo(pDevice, mockKernel, 2, {32, 32, 1}, {1, 1, 1}, {0, 0, 0}); provideLocalWorkGroupSizeHints(context, invalidDispatchInfo); } diff --git a/opencl/test/unit_test/event/event_tests.cpp b/opencl/test/unit_test/event/event_tests.cpp index 7e8966a7f3..5d109b0e00 100644 --- a/opencl/test/unit_test/event/event_tests.cpp +++ b/opencl/test/unit_test/event/event_tests.cpp @@ -574,7 +574,7 @@ TEST_F(InternalsEventTest, givenBlockedKernelWithPrintfWhenSubmittedThenPrintOut uint64_t crossThread[10]; pKernel->setCrossThreadData(&crossThread, sizeof(uint64_t) * 8); - MockMultiDispatchInfo multiDispatchInfo(pKernel); + MockMultiDispatchInfo multiDispatchInfo(pClDevice, pKernel); std::unique_ptr printfHandler(PrintfHandler::create(multiDispatchInfo, *pClDevice)); printfHandler.get()->prepareDispatch(multiDispatchInfo); auto surface = printfHandler.get()->getSurface(); diff --git a/opencl/test/unit_test/execution_model/enqueue_execution_model_kernel_tests.cpp b/opencl/test/unit_test/execution_model/enqueue_execution_model_kernel_tests.cpp index a881dcb8bd..20d9ec9fad 100644 --- a/opencl/test/unit_test/execution_model/enqueue_execution_model_kernel_tests.cpp +++ b/opencl/test/unit_test/execution_model/enqueue_execution_model_kernel_tests.cpp @@ -59,7 +59,7 @@ HWCMDTEST_P(IGFX_GEN8_CORE, ParentKernelEnqueueTest, givenParentKernelWhenEnqueu uint32_t colorCalcSize = DeviceQueue::colorCalcStateSize; EXPECT_EQ(colorCalcSize, executionModelDSHUsedBefore); - MockMultiDispatchInfo multiDispatchInfo(pKernel); + MockMultiDispatchInfo multiDispatchInfo(pClDevice, pKernel); auto graphicsAllocation = pKernel->getKernelInfo().getGraphicsAllocation(); auto kernelIsaAddress = graphicsAllocation->getGpuAddressToPatch(); @@ -253,7 +253,7 @@ HWCMDTEST_P(IGFX_GEN8_CORE, ParentKernelEnqueueTest, givenParentKernelWhenEnqueu uint32_t colorCalcSize = DeviceQueue::colorCalcStateSize; EXPECT_EQ(colorCalcSize, executionModelDSHUsedBefore); - MockMultiDispatchInfo multiDispatchInfo(pKernel); + MockMultiDispatchInfo multiDispatchInfo(pClDevice, pKernel); pCmdQ->enqueueKernel(pKernel, 1, globalOffsets, workItems, workItems, 0, nullptr, nullptr); @@ -273,7 +273,7 @@ HWCMDTEST_P(IGFX_GEN8_CORE, ParentKernelEnqueueTest, givenParentKernelAndNotUsed const size_t workItems[3] = {1, 1, 1}; pKernel->createReflectionSurface(); - MockMultiDispatchInfo multiDispatchInfo(pKernel); + MockMultiDispatchInfo multiDispatchInfo(pClDevice, pKernel); auto ssh = &getIndirectHeap(*pCmdQ, multiDispatchInfo); ssh->replaceBuffer(ssh->getCpuBase(), ssh->getMaxAvailableSpace()); @@ -299,7 +299,7 @@ HWCMDTEST_P(IGFX_GEN8_CORE, ParentKernelEnqueueTest, givenParentKernelWhenEnqueu size_t parentKernelSSHSize = pKernel->getSurfaceStateHeapSize(); - MockMultiDispatchInfo multiDispatchInfo(pKernel); + MockMultiDispatchInfo multiDispatchInfo(pClDevice, pKernel); auto ssh = &getIndirectHeap(*pCmdQ, multiDispatchInfo); // prealign the ssh so that it won't need to be realigned in enqueueKernel @@ -355,7 +355,7 @@ HWCMDTEST_P(IGFX_GEN8_CORE, ParentKernelEnqueueTest, givenParentKernelWhenEnqueu const size_t globalOffsets[3] = {0, 0, 0}; const size_t workItems[3] = {1, 1, 1}; - MockMultiDispatchInfo multiDispatchInfo(pKernel); + MockMultiDispatchInfo multiDispatchInfo(pClDevice, pKernel); pCmdQ->enqueueKernel(pKernel, 1, globalOffsets, workItems, workItems, 0, nullptr, nullptr); EXPECT_NE(nullptr, pKernel->getKernelReflectionSurface()); @@ -366,7 +366,7 @@ HWCMDTEST_P(IGFX_GEN8_CORE, ParentKernelEnqueueTest, givenBlockedQueueWhenParent const size_t workItems[3] = {1, 1, 1}; cl_queue_properties properties[3] = {0}; - MockMultiDispatchInfo multiDispatchInfo(pKernel); + MockMultiDispatchInfo multiDispatchInfo(pClDevice, pKernel); MockDeviceQueueHw mockDevQueue(context, pClDevice, properties[0]); context->setDefaultDeviceQueue(&mockDevQueue); @@ -391,7 +391,7 @@ HWCMDTEST_P(IGFX_GEN8_CORE, ParentKernelEnqueueTest, givenNonBlockedQueueWhenPar const size_t globalOffsets[3] = {0, 0, 0}; const size_t workItems[3] = {1, 1, 1}; - MockMultiDispatchInfo multiDispatchInfo(pKernel); + MockMultiDispatchInfo multiDispatchInfo(pClDevice, pKernel); int32_t executionStamp = 0; auto mockCSR = new MockCsrBase(executionStamp, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield()); diff --git a/opencl/test/unit_test/execution_model/parent_kernel_dispatch_tests.cpp b/opencl/test/unit_test/execution_model/parent_kernel_dispatch_tests.cpp index 2f0bbe1a05..25119134d0 100644 --- a/opencl/test/unit_test/execution_model/parent_kernel_dispatch_tests.cpp +++ b/opencl/test/unit_test/execution_model/parent_kernel_dispatch_tests.cpp @@ -41,7 +41,7 @@ HWCMDTEST_P(IGFX_GEN8_CORE, ParentKernelDispatchTest, givenParentKernelWhenQueue size_t executionModelDSHUsedBefore = pDevQueueHw->getIndirectHeap(IndirectHeap::DYNAMIC_STATE)->getUsed(); - DispatchInfo dispatchInfo(pKernel, 1, workItems, nullptr, globalOffsets); + DispatchInfo dispatchInfo(pClDevice, pKernel, 1, workItems, nullptr, globalOffsets); MultiDispatchInfo multiDispatchInfo(pKernel); multiDispatchInfo.push(dispatchInfo); HardwareInterface::dispatchWalker( @@ -65,7 +65,7 @@ HWCMDTEST_P(IGFX_GEN8_CORE, ParentKernelDispatchTest, givenParentKernelWhenQueue HWCMDTEST_P(IGFX_GEN8_CORE, ParentKernelDispatchTest, givenParentKernelWhenDynamicStateHeapIsRequestedThenDeviceQueueHeapIsReturned) { DeviceQueueHw *pDevQueueHw = castToObject>(pDevQueue); - MockMultiDispatchInfo multiDispatchInfo(pKernel); + MockMultiDispatchInfo multiDispatchInfo(pClDevice, pKernel); auto ish = &getIndirectHeap(*pCmdQ, multiDispatchInfo); auto ishOfDevQueue = pDevQueueHw->getIndirectHeap(IndirectHeap::DYNAMIC_STATE); @@ -75,7 +75,7 @@ HWCMDTEST_P(IGFX_GEN8_CORE, ParentKernelDispatchTest, givenParentKernelWhenDynam HWCMDTEST_P(IGFX_GEN8_CORE, ParentKernelDispatchTest, givenParentKernelWhenIndirectObjectHeapIsRequestedThenDeviceQueueDSHIsReturned) { DeviceQueueHw *pDevQueueHw = castToObject>(pDevQueue); - MockMultiDispatchInfo multiDispatchInfo(pKernel); + MockMultiDispatchInfo multiDispatchInfo(pClDevice, pKernel); auto ioh = &getIndirectHeap(*pCmdQ, multiDispatchInfo); auto dshOfDevQueue = pDevQueueHw->getIndirectHeap(IndirectHeap::DYNAMIC_STATE); @@ -87,11 +87,11 @@ HWCMDTEST_P(IGFX_GEN8_CORE, ParentKernelDispatchTest, givenParentKernelWhenQueue const size_t globalOffsets[3] = {0, 0, 0}; const size_t workItems[3] = {1, 1, 1}; - MockMultiDispatchInfo multiDispatchInfo(pKernel); + MockMultiDispatchInfo multiDispatchInfo(pClDevice, pKernel); auto &ioh = pCmdQ->getIndirectHeap(IndirectHeap::INDIRECT_OBJECT, 0u); - DispatchInfo dispatchInfo(pKernel, 1, workItems, nullptr, globalOffsets); + DispatchInfo dispatchInfo(pClDevice, pKernel, 1, workItems, nullptr, globalOffsets); multiDispatchInfo.push(dispatchInfo); HardwareInterface::dispatchWalker( *pCmdQ, @@ -113,8 +113,8 @@ HWCMDTEST_P(IGFX_GEN8_CORE, ParentKernelDispatchTest, givenParentKernelWhenQueue const size_t globalOffsets[3] = {0, 0, 0}; const size_t workItems[3] = {1, 1, 1}; - MockMultiDispatchInfo multiDispatchInfo(pKernel); - DispatchInfo dispatchInfo(pKernel, 1, workItems, nullptr, globalOffsets); + MockMultiDispatchInfo multiDispatchInfo(pClDevice, pKernel); + DispatchInfo dispatchInfo(pClDevice, pKernel, 1, workItems, nullptr, globalOffsets); multiDispatchInfo.push(dispatchInfo); HardwareInterface::dispatchWalker( *pCmdQ, @@ -147,7 +147,7 @@ HWCMDTEST_P(IGFX_GEN8_CORE, ParentKernelDispatchTest, givenParentKernelWhenQueue MultiDispatchInfo multiDispatchInfo(pKernel); - DispatchInfo dispatchInfo(pKernel, 1, workItems, nullptr, globalOffsets); + DispatchInfo dispatchInfo(pClDevice, pKernel, 1, workItems, nullptr, globalOffsets); multiDispatchInfo.push(dispatchInfo); HardwareInterface::dispatchWalker( *pCmdQ, @@ -192,7 +192,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, ParentKernelCommandStreamFixture, GivenDispatchInfoW if (device->areOcl21FeaturesSupported()) { MockParentKernel *mockParentKernel = MockParentKernel::create(*context); - DispatchInfo dispatchInfo(mockParentKernel, 1, Vec3{24, 1, 1}, Vec3{24, 1, 1}, Vec3{0, 0, 0}); + DispatchInfo dispatchInfo(device, mockParentKernel, 1, Vec3{24, 1, 1}, Vec3{24, 1, 1}, Vec3{0, 0, 0}); MultiDispatchInfo multiDispatchInfo(mockParentKernel); size_t size = EnqueueOperation::getSizeRequiredCS(CL_COMMAND_NDRANGE_KERNEL, false, false, *pCmdQ, mockParentKernel); @@ -256,7 +256,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, MockParentKernelDispatch, GivenBlockedQueueWhenParen const size_t globalOffsets[3] = {0, 0, 0}; const size_t workItems[3] = {1, 1, 1}; - DispatchInfo dispatchInfo(mockParentKernel, 1, workItems, nullptr, globalOffsets); + DispatchInfo dispatchInfo(pClDevice, mockParentKernel, 1, workItems, nullptr, globalOffsets); MultiDispatchInfo multiDispatchInfo(mockParentKernel); multiDispatchInfo.push(dispatchInfo); HardwareInterface::dispatchWalker( @@ -288,7 +288,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, MockParentKernelDispatch, GivenParentKernelWhenDispa const size_t globalOffsets[3] = {0, 0, 0}; const size_t workItems[3] = {1, 1, 1}; - DispatchInfo dispatchInfo(mockParentKernel, 1, workItems, nullptr, globalOffsets); + DispatchInfo dispatchInfo(pClDevice, mockParentKernel, 1, workItems, nullptr, globalOffsets); MultiDispatchInfo multiDispatchInfo(mockParentKernel); multiDispatchInfo.push(dispatchInfo); HardwareInterface::dispatchWalker( @@ -345,7 +345,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, MockParentKernelDispatch, GivenUsedSSHHeapWhenParent // If parent is not using SSH, then heap obtained has zero usage and the same buffer ASSERT_EQ(0u, mockParentKernel->getKernelInfo().heapInfo.SurfaceStateHeapSize); - DispatchInfo dispatchInfo(mockParentKernel, 1, workItems, nullptr, globalOffsets); + DispatchInfo dispatchInfo(pClDevice, mockParentKernel, 1, workItems, nullptr, globalOffsets); MultiDispatchInfo multiDispatchInfo(mockParentKernel); multiDispatchInfo.push(dispatchInfo); HardwareInterface::dispatchWalker( @@ -380,7 +380,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, MockParentKernelDispatch, GivenNotUsedSSHHeapWhenPar auto *bufferMemory = ssh.getCpuBase(); - DispatchInfo dispatchInfo(mockParentKernel, 1, workItems, nullptr, globalOffsets); + DispatchInfo dispatchInfo(pClDevice, mockParentKernel, 1, workItems, nullptr, globalOffsets); MultiDispatchInfo multiDispatchInfo; multiDispatchInfo.push(dispatchInfo); HardwareInterface::dispatchWalker( diff --git a/opencl/test/unit_test/execution_model/submit_blocked_parent_kernel_tests.cpp b/opencl/test/unit_test/execution_model/submit_blocked_parent_kernel_tests.cpp index eb9be1a23e..172d5cb04e 100644 --- a/opencl/test/unit_test/execution_model/submit_blocked_parent_kernel_tests.cpp +++ b/opencl/test/unit_test/execution_model/submit_blocked_parent_kernel_tests.cpp @@ -412,7 +412,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, ParentKernelCommandQueueFixture, givenBlockedCommand const size_t globalOffsets[3] = {0, 0, 0}; const size_t workItems[3] = {1, 1, 1}; - DispatchInfo dispatchInfo(parentKernel.get(), 1, workItems, nullptr, globalOffsets); + DispatchInfo dispatchInfo(device, parentKernel.get(), 1, workItems, nullptr, globalOffsets); MultiDispatchInfo multiDispatchInfo(parentKernel.get()); multiDispatchInfo.push(dispatchInfo); HardwareInterface::dispatchWalker( diff --git a/opencl/test/unit_test/fixtures/cl_preemption_fixture.cpp b/opencl/test/unit_test/fixtures/cl_preemption_fixture.cpp index a5f741903c..6fd3a963be 100644 --- a/opencl/test/unit_test/fixtures/cl_preemption_fixture.cpp +++ b/opencl/test/unit_test/fixtures/cl_preemption_fixture.cpp @@ -44,7 +44,7 @@ void DevicePreemptionTests::SetUp() { kernelInfo->patchInfo.executionEnvironment = executionEnvironment.get(); program = std::make_unique(toClDeviceVector(*device)); kernel.reset(new MockKernel(program.get(), *kernelInfo)); - dispatchInfo.reset(new DispatchInfo(kernel.get(), 1, Vec3(1, 1, 1), Vec3(1, 1, 1), Vec3(0, 0, 0))); + dispatchInfo.reset(new DispatchInfo(device.get(), kernel.get(), 1, Vec3(1, 1, 1), Vec3(1, 1, 1), Vec3(0, 0, 0))); ASSERT_NE(nullptr, device); ASSERT_NE(nullptr, context); diff --git a/opencl/test/unit_test/fixtures/execution_model_fixture.h b/opencl/test/unit_test/fixtures/execution_model_fixture.h index d2585bf894..912ca179bf 100644 --- a/opencl/test/unit_test/fixtures/execution_model_fixture.h +++ b/opencl/test/unit_test/fixtures/execution_model_fixture.h @@ -125,6 +125,4 @@ struct ParentKernelCommandQueueFixture : public CommandQueueHwFixture, return std::make_unique(commandStream, *gpgpuCsr.getInternalAllocationStorage()); } - - MockClDevice *device = nullptr; }; diff --git a/opencl/test/unit_test/helpers/dispatch_info_builder_tests.cpp b/opencl/test/unit_test/helpers/dispatch_info_builder_tests.cpp index dd02434117..a3f15351c4 100644 --- a/opencl/test/unit_test/helpers/dispatch_info_builder_tests.cpp +++ b/opencl/test/unit_test/helpers/dispatch_info_builder_tests.cpp @@ -101,6 +101,7 @@ typedef Test DispatchInfoBuilderTest; template class DispatchInfoBuilderMock : DispatchInfoBuilder { public: + using DispatchInfoBuilder::DispatchInfoBuilder; void pushSplit(const DispatchInfo &dispatchInfo, MultiDispatchInfo &outMdi) { DispatchInfoBuilder::pushSplit(dispatchInfo, outMdi); } @@ -109,7 +110,7 @@ class DispatchInfoBuilderMock : DispatchInfoBuilder { TEST_F(DispatchInfoBuilderTest, Given1dWhenSplittingMultiDispatchInfoThenMultiDispatchInfo) { MultiDispatchInfo multiDispatchInfo; - DispatchInfoBuilderMock *diBuilder = new DispatchInfoBuilderMock(); + auto diBuilder = new DispatchInfoBuilderMock(*pClDevice); ASSERT_NE(nullptr, diBuilder); DispatchInfo dispatchInfo; @@ -122,13 +123,13 @@ TEST_F(DispatchInfoBuilderTest, Given1dWhenSplittingMultiDispatchInfoThenMultiDi TEST_F(DispatchInfoBuilderTest, WhenGettingDimensionThenCorrectDimensionIsReturned) { MultiDispatchInfo mdi1D, mdi2D, mdi3D; - DispatchInfoBuilder *diBuilder1D = new DispatchInfoBuilder(); + DispatchInfoBuilder *diBuilder1D = new DispatchInfoBuilder(*pClDevice); ASSERT_NE(nullptr, diBuilder1D); - DispatchInfoBuilder *diBuilder2D = new DispatchInfoBuilder(); + DispatchInfoBuilder *diBuilder2D = new DispatchInfoBuilder(*pClDevice); ASSERT_NE(nullptr, diBuilder2D); - DispatchInfoBuilder *diBuilder3D = new DispatchInfoBuilder(); + DispatchInfoBuilder *diBuilder3D = new DispatchInfoBuilder(*pClDevice); ASSERT_NE(nullptr, diBuilder3D); diBuilder1D->setDispatchGeometry(Vec3(1, 0, 0), Vec3(0, 0, 0), Vec3(0, 0, 0)); @@ -155,7 +156,7 @@ TEST_F(DispatchInfoBuilderTest, WhenGettingDimensionThenCorrectDimensionIsReturn } TEST_F(DispatchInfoBuilderTest, WhenGettingGwsThenCorrectValuesAreReturned) { - DispatchInfoBuilder *diBuilder = new DispatchInfoBuilder(); + DispatchInfoBuilder *diBuilder = new DispatchInfoBuilder(*pClDevice); ASSERT_NE(nullptr, diBuilder); MultiDispatchInfo mdi0, mdi1, mdi2, mdi3; @@ -201,7 +202,7 @@ TEST_F(DispatchInfoBuilderTest, WhenGettingGwsThenCorrectValuesAreReturned) { } TEST_F(DispatchInfoBuilderTest, WhenGettingElwsThenCorrectValuesAreReturned) { - DispatchInfoBuilder *diBuilder = new DispatchInfoBuilder(); + DispatchInfoBuilder *diBuilder = new DispatchInfoBuilder(*pClDevice); ASSERT_NE(nullptr, diBuilder); MultiDispatchInfo mdi0, mdi1, mdi2, mdi3; @@ -247,7 +248,7 @@ TEST_F(DispatchInfoBuilderTest, WhenGettingElwsThenCorrectValuesAreReturned) { } TEST_F(DispatchInfoBuilderTest, WhenGettingLwsThenCorrectValuesAreReturned) { - DispatchInfoBuilder *diBuilder = new DispatchInfoBuilder(); + DispatchInfoBuilder *diBuilder = new DispatchInfoBuilder(*pClDevice); ASSERT_NE(nullptr, diBuilder); MultiDispatchInfo mdi0, mdi1, mdi2, mdi3; @@ -301,7 +302,7 @@ TEST_F(DispatchInfoBuilderTest, WhenGettingLwsThenCorrectValuesAreReturned) { } TEST_F(DispatchInfoBuilderTest, GivenNoSplitWhenCheckingIfBuiltinThenReturnTrue) { - DispatchInfoBuilder *diBuilder = new DispatchInfoBuilder(); + DispatchInfoBuilder *diBuilder = new DispatchInfoBuilder(*pClDevice); ASSERT_NE(nullptr, diBuilder); diBuilder->setKernel(pKernel); @@ -318,13 +319,13 @@ TEST_F(DispatchInfoBuilderTest, GivenNoSplitWhenCheckingIfBuiltinThenReturnTrue) } TEST_F(DispatchInfoBuilderTest, GivenSplitWhenCheckingIfBuiltinThenReturnTrue) { - DispatchInfoBuilder *diBuilder1D = new DispatchInfoBuilder(); + DispatchInfoBuilder *diBuilder1D = new DispatchInfoBuilder(*pClDevice); ASSERT_NE(nullptr, diBuilder1D); - DispatchInfoBuilder *diBuilder2D = new DispatchInfoBuilder(); + DispatchInfoBuilder *diBuilder2D = new DispatchInfoBuilder(*pClDevice); ASSERT_NE(nullptr, diBuilder2D); - DispatchInfoBuilder *diBuilder3D = new DispatchInfoBuilder(); + DispatchInfoBuilder *diBuilder3D = new DispatchInfoBuilder(*pClDevice); ASSERT_NE(nullptr, diBuilder3D); // 1D @@ -365,13 +366,13 @@ TEST_F(DispatchInfoBuilderTest, GivenSplitWhenCheckingIfBuiltinThenReturnTrue) { } TEST_F(DispatchInfoBuilderTest, GivenNoSplitWhenGettingWalkerInfoThenCorrectValuesAreReturned) { - DispatchInfoBuilder *diBuilder1D = new DispatchInfoBuilder(); + DispatchInfoBuilder *diBuilder1D = new DispatchInfoBuilder(*pClDevice); ASSERT_NE(nullptr, diBuilder1D); - DispatchInfoBuilder *diBuilder2D = new DispatchInfoBuilder(); + DispatchInfoBuilder *diBuilder2D = new DispatchInfoBuilder(*pClDevice); ASSERT_NE(nullptr, diBuilder2D); - DispatchInfoBuilder *diBuilder3D = new DispatchInfoBuilder(); + DispatchInfoBuilder *diBuilder3D = new DispatchInfoBuilder(*pClDevice); ASSERT_NE(nullptr, diBuilder3D); // 1D @@ -476,13 +477,13 @@ TEST_F(DispatchInfoBuilderTest, GivenNoSplitWhenGettingWalkerInfoThenCorrectValu } TEST_F(DispatchInfoBuilderTest, GivenSplitWhenGettingWalkerInfoThenCorrectValuesAreReturned) { - DispatchInfoBuilder *diBuilder1D = new DispatchInfoBuilder(); + DispatchInfoBuilder *diBuilder1D = new DispatchInfoBuilder(*pClDevice); ASSERT_NE(nullptr, diBuilder1D); - DispatchInfoBuilder *diBuilder2D = new DispatchInfoBuilder(); + DispatchInfoBuilder *diBuilder2D = new DispatchInfoBuilder(*pClDevice); ASSERT_NE(nullptr, diBuilder2D); - DispatchInfoBuilder *diBuilder3D = new DispatchInfoBuilder(); + DispatchInfoBuilder *diBuilder3D = new DispatchInfoBuilder(*pClDevice); ASSERT_NE(nullptr, diBuilder3D); // 1D @@ -767,7 +768,7 @@ TEST_F(DispatchInfoBuilderTest, GivenSplitWhenGettingWalkerInfoThenCorrectValues } TEST_F(DispatchInfoBuilderTest, GivenSplit1dWhenSettingDispatchGeometryThenMdiSizeIsCorrect) { - DispatchInfoBuilder *diBuilder = new DispatchInfoBuilder(); + DispatchInfoBuilder *diBuilder = new DispatchInfoBuilder(*pClDevice); ASSERT_NE(nullptr, diBuilder); diBuilder->setDispatchGeometry(Vec3(0, 0, 0), Vec3(2, 0, 0), Vec3(0, 0, 0)); @@ -789,7 +790,7 @@ TEST_F(DispatchInfoBuilderTest, GivenSplit1dWhenSettingDispatchGeometryThenMdiSi } TEST_F(DispatchInfoBuilderTest, GivenSplit2dWhenSettingDispatchGeometryThenMdiSizeIsCorrect) { - DispatchInfoBuilder *diBuilder = new DispatchInfoBuilder(); + DispatchInfoBuilder *diBuilder = new DispatchInfoBuilder(*pClDevice); ASSERT_NE(nullptr, diBuilder); diBuilder->setDispatchGeometry(Vec3(0, 0, 0), Vec3(2, 2, 0), Vec3(0, 0, 0)); @@ -821,7 +822,7 @@ TEST_F(DispatchInfoBuilderTest, GivenSplit2dWhenSettingDispatchGeometryThenMdiSi } TEST_F(DispatchInfoBuilderTest, GivenSplit3dWhenSettingDispatchGeometryThenMdiSizeIsCorrect) { - DispatchInfoBuilder *diBuilder = new DispatchInfoBuilder(); + DispatchInfoBuilder *diBuilder = new DispatchInfoBuilder(*pClDevice); ASSERT_NE(nullptr, diBuilder); diBuilder->setDispatchGeometry(Vec3(0, 0, 0), Vec3(2, 2, 2), Vec3(0, 0, 0)); @@ -878,7 +879,7 @@ TEST_F(DispatchInfoBuilderTest, WhenSettingKernelArgThenAddressesAreCorrect) { auto val = (cl_mem)buffer; auto pVal = &val; - DispatchInfoBuilder *diBuilder = new DispatchInfoBuilder(); + DispatchInfoBuilder *diBuilder = new DispatchInfoBuilder(*pClDevice); ASSERT_NE(nullptr, diBuilder); diBuilder->setKernel(pKernel); @@ -909,9 +910,9 @@ TEST_F(DispatchInfoBuilderTest, WhenSettingKernelArgThenAddressesAreCorrect) { } TEST_F(DispatchInfoBuilderTest, GivenSplitWhenSettingKernelArgThenAddressesAreCorrect) { - DispatchInfoBuilder builder1D; - DispatchInfoBuilder builder2D; - DispatchInfoBuilder builder3D; + DispatchInfoBuilder builder1D(*pClDevice); + DispatchInfoBuilder builder2D(*pClDevice); + DispatchInfoBuilder builder3D(*pClDevice); Buffer *buffer = new MockBuffer(); auto val = (cl_mem)buffer; @@ -982,7 +983,7 @@ TEST_F(DispatchInfoBuilderTest, GivenInvalidInputWhenSettingKernelArgThenInvalid auto val = (cl_mem)buffer; auto pVal = &val; - DispatchInfoBuilder *diBuilder = new DispatchInfoBuilder(); + DispatchInfoBuilder *diBuilder = new DispatchInfoBuilder(*pClDevice); ASSERT_NE(nullptr, diBuilder); diBuilder->setKernel(pKernel); @@ -1005,7 +1006,7 @@ TEST_F(DispatchInfoBuilderTest, GivenNullKernelWhenSettingKernelArgThenSuccessIs void *svmPtr = &data; MockGraphicsAllocation svmAlloc(svmPtr, 128); - DispatchInfoBuilder *diBuilder = new DispatchInfoBuilder(); + DispatchInfoBuilder *diBuilder = new DispatchInfoBuilder(*pClDevice); ASSERT_NE(nullptr, diBuilder); diBuilder->setDispatchGeometry(Vec3(256, 256, 256), Vec3(16, 16, 16), Vec3(0, 0, 0)); diff --git a/opencl/test/unit_test/helpers/dispatch_info_tests.cpp b/opencl/test/unit_test/helpers/dispatch_info_tests.cpp index c6884620ec..906640ce40 100644 --- a/opencl/test/unit_test/helpers/dispatch_info_tests.cpp +++ b/opencl/test/unit_test/helpers/dispatch_info_tests.cpp @@ -86,7 +86,7 @@ TEST_F(DispatchInfoTest, GivenUserGeometryWhenDispatchInfoIsCreatedThenValuesAre Vec3 gws({256, 256, 256}); Vec3 elws({16, 16, 16}); Vec3 offset({1, 2, 3}); - std::unique_ptr dispatchInfo(new DispatchInfo(pKernel, 3, gws, elws, offset)); + std::unique_ptr dispatchInfo(new DispatchInfo(pClDevice, pKernel, 3, gws, elws, offset)); EXPECT_NE(nullptr, dispatchInfo->getKernel()); EXPECT_EQ(1024u, dispatchInfo->getRequiredScratchSize()); @@ -119,7 +119,7 @@ TEST_F(DispatchInfoTest, GivenFullGeometryWhenDispatchInfoIsCreatedThenValuesAre Vec3 twgs({8, 8, 8}); Vec3 nwgs({8, 8, 8}); Vec3 swgs({0, 0, 0}); - std::unique_ptr dispatchInfo(new DispatchInfo(pKernel, 3, gws, elws, offset, agws, lws, twgs, nwgs, swgs)); + std::unique_ptr dispatchInfo(new DispatchInfo(pClDevice, pKernel, 3, gws, elws, offset, agws, lws, twgs, nwgs, swgs)); EXPECT_NE(nullptr, dispatchInfo->getKernel()); EXPECT_EQ(1024u, dispatchInfo->getRequiredScratchSize()); @@ -187,7 +187,7 @@ TEST_F(DispatchInfoTest, GivenUserGeometryWhenMultiDispatchInfoIsCreatedThenValu Vec3 elws({16, 16, 16}); Vec3 offset({1, 2, 3}); - DispatchInfo dispatchInfo(pKernel, 3, gws, elws, offset); + DispatchInfo dispatchInfo(pClDevice, pKernel, 3, gws, elws, offset); MultiDispatchInfo multiDispatchInfo; multiDispatchInfo.push(dispatchInfo); @@ -220,7 +220,7 @@ TEST_F(DispatchInfoTest, GivenFullGeometryWhenMultiDispatchInfoIsCreatedThenValu Vec3 nwgs({8, 8, 8}); Vec3 swgs({0, 0, 0}); - DispatchInfo dispatchInfo(pKernel, 3, gws, elws, offset, agws, lws, twgs, nwgs, swgs); + DispatchInfo dispatchInfo(pClDevice, pKernel, 3, gws, elws, offset, agws, lws, twgs, nwgs, swgs); MultiDispatchInfo multiDispatchInfo; multiDispatchInfo.push(dispatchInfo); @@ -277,9 +277,9 @@ TEST_F(DispatchInfoTest, givenKernelWhenMultiDispatchInfoIsCreatedThenQueryParen std::unique_ptr baseKernel(MockKernel::create(*pDevice, pProgram)); std::unique_ptr builtInKernel(MockKernel::create(*pDevice, pProgram)); builtInKernel->isBuiltIn = true; - DispatchInfo parentKernelDispatchInfo(parentKernel.get(), 1, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}); - DispatchInfo baseDispatchInfo(baseKernel.get(), 1, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}); - DispatchInfo builtInDispatchInfo(builtInKernel.get(), 1, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}); + DispatchInfo parentKernelDispatchInfo(pClDevice, parentKernel.get(), 1, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}); + DispatchInfo baseDispatchInfo(pClDevice, baseKernel.get(), 1, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}); + DispatchInfo builtInDispatchInfo(pClDevice, builtInKernel.get(), 1, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}); { MultiDispatchInfo multiDispatchInfo(parentKernel.get()); diff --git a/opencl/test/unit_test/helpers/timestamp_packet_tests.cpp b/opencl/test/unit_test/helpers/timestamp_packet_tests.cpp index af53bebf50..d517751642 100644 --- a/opencl/test/unit_test/helpers/timestamp_packet_tests.cpp +++ b/opencl/test/unit_test/helpers/timestamp_packet_tests.cpp @@ -373,7 +373,7 @@ HWTEST_F(TimestampPacketTests, givenDebugFlagSetWhenCreatingTimestampPacketAlloc HWCMDTEST_F(IGFX_GEN8_CORE, TimestampPacketTests, givenTimestampPacketWriteEnabledWhenEstimatingStreamSizeThenAddPipeControl) { MockKernelWithInternals kernel2(*device); - MockMultiDispatchInfo multiDispatchInfo(std::vector({kernel->mockKernel, kernel2.mockKernel})); + MockMultiDispatchInfo multiDispatchInfo(device.get(), std::vector({kernel->mockKernel, kernel2.mockKernel})); auto mockCmdQHw = std::make_unique>(context, device.get(), nullptr); device->getUltCommandStreamReceiver().timestampPacketWriteEnabled = false; @@ -389,7 +389,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, TimestampPacketTests, givenTimestampPacketWriteEnabl } HWTEST_F(TimestampPacketTests, givenTimestampPacketWriteEnabledAndOoqWhenEstimatingStreamSizeDontDontAddAdditionalSize) { - MockMultiDispatchInfo multiDispatchInfo(std::vector({kernel->mockKernel})); + MockMultiDispatchInfo multiDispatchInfo(device.get(), std::vector({kernel->mockKernel})); auto mockCmdQHw = std::make_unique>(context, device.get(), nullptr); mockCmdQHw->setOoqEnabled(); @@ -441,7 +441,7 @@ HWTEST_F(TimestampPacketTests, givenTimestampPacketWriteEnabledAndOoqWhenEstimat HWTEST_F(TimestampPacketTests, givenTimestampPacketWriteEnabledWhenEstimatingStreamSizeWithWaitlistThenAddSizeForSemaphores) { MockKernelWithInternals kernel2(*device); - MockMultiDispatchInfo multiDispatchInfo(std::vector({kernel->mockKernel, kernel2.mockKernel})); + MockMultiDispatchInfo multiDispatchInfo(device.get(), std::vector({kernel->mockKernel, kernel2.mockKernel})); auto mockCmdQHw = std::make_unique>(context, device.get(), nullptr); device->getUltCommandStreamReceiver().timestampPacketWriteEnabled = false; @@ -588,7 +588,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, TimestampPacketTests, givenTimestampPacketWhenDispat MockKernelWithInternals kernel2(*device); - MockMultiDispatchInfo multiDispatchInfo(std::vector({kernel->mockKernel, kernel2.mockKernel})); + MockMultiDispatchInfo multiDispatchInfo(device.get(), std::vector({kernel->mockKernel, kernel2.mockKernel})); auto &cmdStream = mockCmdQ->getCS(0); @@ -632,7 +632,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, TimestampPacketTests, givenTimestampPacketWhenDispat HWCMDTEST_F(IGFX_GEN8_CORE, TimestampPacketTests, givenTimestampPacketDisabledWhenDispatchingGpuWalkerThenDontAddPipeControls) { MockTimestampPacketContainer timestampPacket(*device->getGpgpuCommandStreamReceiver().getTimestampPacketAllocator(), 1); - MockMultiDispatchInfo multiDispatchInfo(kernel->mockKernel); + MockMultiDispatchInfo multiDispatchInfo(device.get(), kernel->mockKernel); auto &cmdStream = mockCmdQ->getCS(0); device->getUltCommandStreamReceiver().timestampPacketWriteEnabled = false; @@ -1121,7 +1121,7 @@ HWTEST_F(TimestampPacketTests, givenTimestampPacketWriteEnabledWhenDispatchingTh device2->getUltCommandStreamReceiver().timestampPacketWriteEnabled = true; MockContext context2(device2.get()); - MockMultiDispatchInfo multiDispatchInfo(std::vector({kernel->mockKernel})); + MockMultiDispatchInfo multiDispatchInfo(device.get(), std::vector({kernel->mockKernel})); MockCommandQueue mockCmdQ2(&context2, device2.get(), nullptr); auto &cmdStream = mockCmdQ->getCS(0); @@ -1200,7 +1200,7 @@ HWTEST_F(TimestampPacketTests, givenTimestampPacketWriteEnabledOnDifferentCSRsFr device->getUltCommandStreamReceiver().timestampPacketWriteEnabled = true; - MockMultiDispatchInfo multiDispatchInfo(std::vector({kernel->mockKernel})); + MockMultiDispatchInfo multiDispatchInfo(device.get(), std::vector({kernel->mockKernel})); // Create second (LOW_PRIORITY) queue on the same device cl_queue_properties props[] = {CL_QUEUE_PRIORITY_KHR, CL_QUEUE_PRIORITY_LOW_KHR, 0}; 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 db42720915..a833b50f49 100644 --- a/opencl/test/unit_test/kernel/kernel_reflection_surface_tests.cpp +++ b/opencl/test/unit_test/kernel/kernel_reflection_surface_tests.cpp @@ -1895,7 +1895,7 @@ TEST_F(ReflectionSurfaceTestForPrintfHandler, GivenPrintfHandlerWhenPatchingRefl context.setDefaultDeviceQueue(&devQueue); - MockMultiDispatchInfo multiDispatchInfo(parentKernel); + MockMultiDispatchInfo multiDispatchInfo(device, parentKernel); PrintfHandler *printfHandler = PrintfHandler::create(multiDispatchInfo, *device); printfHandler->prepareDispatch(multiDispatchInfo); @@ -1923,7 +1923,7 @@ TEST_F(ReflectionSurfaceTestForPrintfHandler, GivenNoPrintfSurfaceWhenPatchingRe context.setDefaultDeviceQueue(&devQueue); - MockMultiDispatchInfo multiDispatchInfo(parentKernel); + MockMultiDispatchInfo multiDispatchInfo(device, parentKernel); PrintfHandler *printfHandler = PrintfHandler::create(multiDispatchInfo, *device); parentKernel->patchReflectionSurface(&devQueue, printfHandler); diff --git a/opencl/test/unit_test/kernel/kernel_tests.cpp b/opencl/test/unit_test/kernel/kernel_tests.cpp index c7d7052dbb..2798ff339b 100644 --- a/opencl/test/unit_test/kernel/kernel_tests.cpp +++ b/opencl/test/unit_test/kernel/kernel_tests.cpp @@ -2573,9 +2573,7 @@ TEST(KernelTest, GivenNormalKernelWhenGettingInstructionHeapSizeForExecutionMode TEST(KernelTest, WhenSettingKernelArgThenBuiltinDispatchInfoBuilderIsUsed) { struct MockBuiltinDispatchBuilder : BuiltinDispatchInfoBuilder { - MockBuiltinDispatchBuilder(BuiltIns &builtins) - : BuiltinDispatchInfoBuilder(builtins) { - } + using BuiltinDispatchInfoBuilder::BuiltinDispatchInfoBuilder; bool setExplicitArg(uint32_t argIndex, size_t argSize, const void *argVal, cl_int &err) const override { receivedArgs.push_back(std::make_tuple(argIndex, argSize, argVal)); @@ -2593,7 +2591,7 @@ TEST(KernelTest, WhenSettingKernelArgThenBuiltinDispatchInfoBuilderIsUsed) { kernel.kernelInfo.resizeKernelArgInfoAndRegisterParameter(1); kernel.mockKernel->initialize(); - MockBuiltinDispatchBuilder mockBuilder(*device->getBuiltIns()); + MockBuiltinDispatchBuilder mockBuilder(*device->getBuiltIns(), *device); kernel.kernelInfo.builtinDispatchBuilder = &mockBuilder; mockBuilder.valueToReturn = false; diff --git a/opencl/test/unit_test/memory_manager/memory_manager_tests.cpp b/opencl/test/unit_test/memory_manager/memory_manager_tests.cpp index d86eb50cbf..c44444feec 100644 --- a/opencl/test/unit_test/memory_manager/memory_manager_tests.cpp +++ b/opencl/test/unit_test/memory_manager/memory_manager_tests.cpp @@ -515,7 +515,7 @@ class MockPrintfHandler : public PrintfHandler { TEST_F(MemoryAllocatorTest, givenStatelessKernelWithPrintfWhenPrintfSurfaceIsCreatedThenPrintfSurfaceIsPatchedWithBaseAddressOffset) { auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(defaultHwInfo.get())); MockKernelWithInternals kernel(*device); - MockMultiDispatchInfo multiDispatchInfo(kernel.mockKernel); + MockMultiDispatchInfo multiDispatchInfo(device.get(), kernel.mockKernel); SPatchAllocateStatelessPrintfSurface printfSurface; printfSurface.Token = iOpenCL::PATCH_TOKEN_ALLOCATE_STATELESS_PRINTF_SURFACE; printfSurface.Size = static_cast(sizeof(SPatchAllocateStatelessPrintfSurface)); @@ -551,7 +551,7 @@ TEST_F(MemoryAllocatorTest, givenStatelessKernelWithPrintfWhenPrintfSurfaceIsCre HWTEST_F(MemoryAllocatorTest, givenStatefulKernelWithPrintfWhenPrintfSurfaceIsCreatedThenPrintfSurfaceIsPatchedWithCpuAddress) { auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(defaultHwInfo.get())); MockKernelWithInternals kernel(*device); - MockMultiDispatchInfo multiDispatchInfo(kernel.mockKernel); + MockMultiDispatchInfo multiDispatchInfo(device.get(), kernel.mockKernel); SPatchAllocateStatelessPrintfSurface printfSurface; printfSurface.Token = iOpenCL::PATCH_TOKEN_ALLOCATE_STATELESS_PRINTF_SURFACE; printfSurface.Size = static_cast(sizeof(SPatchAllocateStatelessPrintfSurface)); @@ -593,7 +593,7 @@ TEST_F(MemoryAllocatorTest, given32BitDeviceWhenPrintfSurfaceIsCreatedThen32BitA DebugManager.flags.Force32bitAddressing.set(true); auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(defaultHwInfo.get())); MockKernelWithInternals kernel(*device); - MockMultiDispatchInfo multiDispatchInfo(kernel.mockKernel); + MockMultiDispatchInfo multiDispatchInfo(device.get(), kernel.mockKernel); SPatchAllocateStatelessPrintfSurface printfSurface; printfSurface.Token = iOpenCL::PATCH_TOKEN_ALLOCATE_STATELESS_PRINTF_SURFACE; printfSurface.Size = static_cast(sizeof(SPatchAllocateStatelessPrintfSurface)); diff --git a/opencl/test/unit_test/mocks/mock_builtin_dispatch_info_builder.h b/opencl/test/unit_test/mocks/mock_builtin_dispatch_info_builder.h index 3eee2ab41b..7c78a7bb53 100644 --- a/opencl/test/unit_test/mocks/mock_builtin_dispatch_info_builder.h +++ b/opencl/test/unit_test/mocks/mock_builtin_dispatch_info_builder.h @@ -14,8 +14,8 @@ using namespace NEO; class MockBuiltinDispatchInfoBuilder : public BuiltinDispatchInfoBuilder { public: - MockBuiltinDispatchInfoBuilder(BuiltIns &kernelLib, BuiltinDispatchInfoBuilder *origBuilder) - : BuiltinDispatchInfoBuilder(kernelLib), originalBuilder(origBuilder) { + MockBuiltinDispatchInfoBuilder(BuiltIns &kernelLib, ClDevice &clDevice, BuiltinDispatchInfoBuilder *origBuilder) + : BuiltinDispatchInfoBuilder(kernelLib, clDevice), originalBuilder(origBuilder) { } virtual void validateInput(const BuiltinOpParams &conf) const {}; diff --git a/opencl/test/unit_test/mocks/mock_mdi.h b/opencl/test/unit_test/mocks/mock_mdi.h index 270b6a3942..da9b8a1624 100644 --- a/opencl/test/unit_test/mocks/mock_mdi.h +++ b/opencl/test/unit_test/mocks/mock_mdi.h @@ -15,13 +15,13 @@ class MockMultiDispatchInfo : public MultiDispatchInfo { public: using MultiDispatchInfo::dispatchInfos; - MockMultiDispatchInfo(Kernel *kernel) : MultiDispatchInfo(kernel) { - DispatchInfo di(kernel, 1, {100, 1, 1}, {10, 1, 1}, {0, 0, 0}); + MockMultiDispatchInfo(ClDevice *clDevice, Kernel *kernel) : MultiDispatchInfo(kernel) { + DispatchInfo di(clDevice, kernel, 1, {100, 1, 1}, {10, 1, 1}, {0, 0, 0}); dispatchInfos.push_back(di); } - MockMultiDispatchInfo(std::vector kernels) { + MockMultiDispatchInfo(ClDevice *clDevice, std::vector kernels) { for (auto kernel : kernels) { - DispatchInfo di(kernel, 1, {100, 1, 1}, {10, 1, 1}, {0, 0, 0}); + DispatchInfo di(clDevice, kernel, 1, {100, 1, 1}, {10, 1, 1}, {0, 0, 0}); dispatchInfos.push_back(di); } } diff --git a/opencl/test/unit_test/preemption/preemption_tests.cpp b/opencl/test/unit_test/preemption/preemption_tests.cpp index d89de6aa1d..1fc38a0c29 100644 --- a/opencl/test/unit_test/preemption/preemption_tests.cpp +++ b/opencl/test/unit_test/preemption/preemption_tests.cpp @@ -149,7 +149,7 @@ TEST_F(ThreadGroupPreemptionTests, disallowDefaultDeviceModeForValidKernelsInMdi TEST_F(ThreadGroupPreemptionTests, disallowDefaultDeviceModeWhenAtLeastOneInvalidKernelInMdi) { MockKernel schedulerKernel(program.get(), *kernelInfo, true); - DispatchInfo schedulerDispatchInfo(&schedulerKernel, 1, Vec3(1, 1, 1), Vec3(1, 1, 1), Vec3(0, 0, 0)); + DispatchInfo schedulerDispatchInfo(device.get(), &schedulerKernel, 1, Vec3(1, 1, 1), Vec3(1, 1, 1), Vec3(0, 0, 0)); PreemptionFlags flags = {}; PreemptionHelper::setPreemptionLevelFlags(flags, device->getDevice(), &schedulerKernel); diff --git a/opencl/test/unit_test/program/printf_handler_tests.cpp b/opencl/test/unit_test/program/printf_handler_tests.cpp index 4d8dbbccce..2e5581c45f 100644 --- a/opencl/test/unit_test/program/printf_handler_tests.cpp +++ b/opencl/test/unit_test/program/printf_handler_tests.cpp @@ -33,7 +33,7 @@ TEST(PrintfHandlerTest, givenNotPreparedPrintfHandlerWhenGetSurfaceIsCalledThenR MockProgram *pProgram = new MockProgram(&context, false, toClDeviceVector(*device)); MockKernel *pKernel = new MockKernel(pProgram, *pKernelInfo); - MockMultiDispatchInfo multiDispatchInfo(pKernel); + MockMultiDispatchInfo multiDispatchInfo(device, pKernel); PrintfHandler *printfHandler = PrintfHandler::create(multiDispatchInfo, *device); EXPECT_EQ(nullptr, printfHandler->getSurface()); @@ -62,7 +62,7 @@ TEST(PrintfHandlerTest, givenPreparedPrintfHandlerWhenGetSurfaceIsCalledThenResu MockKernel *pKernel = new MockKernel(pProgram, *pKernelInfo); pKernel->setCrossThreadData(&crossThread, sizeof(uint64_t) * 8); - MockMultiDispatchInfo multiDispatchInfo(pKernel); + MockMultiDispatchInfo multiDispatchInfo(device, pKernel); PrintfHandler *printfHandler = PrintfHandler::create(multiDispatchInfo, *device); printfHandler->prepareDispatch(multiDispatchInfo); EXPECT_NE(nullptr, printfHandler->getSurface()); @@ -81,7 +81,7 @@ TEST(PrintfHandlerTest, givenParentKernelWihoutPrintfAndBlockKernelWithPrintfWhe MockContext context(device.get()); std::unique_ptr parentKernelWithoutPrintf(MockParentKernel::create(context, false, false, false, false)); - MockMultiDispatchInfo multiDispatchInfo(parentKernelWithoutPrintf.get()); + MockMultiDispatchInfo multiDispatchInfo(device.get(), parentKernelWithoutPrintf.get()); std::unique_ptr printfHandler(PrintfHandler::create(multiDispatchInfo, *device)); @@ -94,7 +94,7 @@ TEST(PrintfHandlerTest, givenParentKernelAndBlockKernelWithoutPrintfWhenPrintfHa MockContext context(device.get()); std::unique_ptr blockKernelWithoutPrintf(MockParentKernel::create(context, false, false, false, false, false)); - MockMultiDispatchInfo multiDispatchInfo(blockKernelWithoutPrintf.get()); + MockMultiDispatchInfo multiDispatchInfo(device.get(), blockKernelWithoutPrintf.get()); std::unique_ptr printfHandler(PrintfHandler::create(multiDispatchInfo, *device)); @@ -106,7 +106,7 @@ TEST(PrintfHandlerTest, givenParentKernelWithPrintfAndBlockKernelWithoutPrintfWh MockContext context(device.get()); std::unique_ptr parentKernelWithPrintfBlockKernelWithoutPrintf(MockParentKernel::create(context, false, false, false, true, false)); - MockMultiDispatchInfo multiDispatchInfo(parentKernelWithPrintfBlockKernelWithoutPrintf.get()); + MockMultiDispatchInfo multiDispatchInfo(device.get(), parentKernelWithPrintfBlockKernelWithoutPrintf.get()); std::unique_ptr printfHandler(PrintfHandler::create(multiDispatchInfo, *device)); @@ -132,9 +132,9 @@ TEST(PrintfHandlerTest, givenMultiDispatchInfoWithMultipleKernelsWhenCreatingAnd auto kernel2 = std::make_unique(program.get(), *kernelInfo); mainKernel->setCrossThreadData(&crossThread, sizeof(uint64_t) * 8); - DispatchInfo mainDispatchInfo(mainKernel.get(), 1, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}); - DispatchInfo dispatchInfo1(kernel1.get(), 1, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}); - DispatchInfo dispatchInfo2(kernel2.get(), 1, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}); + DispatchInfo mainDispatchInfo(device.get(), mainKernel.get(), 1, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}); + DispatchInfo dispatchInfo1(device.get(), kernel1.get(), 1, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}); + DispatchInfo dispatchInfo2(device.get(), kernel2.get(), 1, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}); MultiDispatchInfo multiDispatchInfo(mainKernel.get()); multiDispatchInfo.push(dispatchInfo1); @@ -151,7 +151,7 @@ TEST(PrintfHandlerTest, givenMultiDispatchInfoWithMultipleKernelsWhenCreatingAnd TEST(PrintfHandlerTest, GivenEmptyMultiDispatchInfoWhenCreatingPrintfHandlerThenPrintfHandlerIsNotCreated) { MockClDevice device{new MockDevice}; MockKernelWithInternals mockKernelWithInternals{device}; - MockMultiDispatchInfo multiDispatchInfo{mockKernelWithInternals.mockKernel}; + MockMultiDispatchInfo multiDispatchInfo{&device, mockKernelWithInternals.mockKernel}; multiDispatchInfo.dispatchInfos.resize(0); EXPECT_EQ(nullptr, multiDispatchInfo.peekMainKernel()); @@ -201,7 +201,7 @@ TEST(PrintfHandlerTest, GivenAllocationInLocalMemoryWhichRequiresBlitterWhenPrep auto kernel = std::make_unique(program.get(), *kernelInfo); kernel->setCrossThreadData(&crossThread, sizeof(uint64_t) * 8); - MockMultiDispatchInfo multiDispatchInfo(kernel.get()); + MockMultiDispatchInfo multiDispatchInfo(pClDevice.get(), kernel.get()); std::unique_ptr printfHandler(PrintfHandler::create(multiDispatchInfo, *pClDevice)); printfHandler->prepareDispatch(multiDispatchInfo); @@ -230,7 +230,7 @@ TEST_F(PrintfHandlerMultiRootDeviceTests, printfSurfaceHasCorrectRootDeviceIndex auto kernel = std::make_unique(program.get(), *kernelInfo); kernel->setCrossThreadData(&crossThread, sizeof(uint64_t) * 8); - MockMultiDispatchInfo multiDispatchInfo(kernel.get()); + MockMultiDispatchInfo multiDispatchInfo(device.get(), kernel.get()); std::unique_ptr printfHandler(PrintfHandler::create(multiDispatchInfo, *device)); printfHandler->prepareDispatch(multiDispatchInfo); auto surface = printfHandler->getSurface(); diff --git a/opencl/test/unit_test/utilities/file_logger_tests.cpp b/opencl/test/unit_test/utilities/file_logger_tests.cpp index f84e4100ca..35304c1bb1 100644 --- a/opencl/test/unit_test/utilities/file_logger_tests.cpp +++ b/opencl/test/unit_test/utilities/file_logger_tests.cpp @@ -349,7 +349,7 @@ TEST(FileLogger, GivenDebugFunctionalityWhenDebugFlagIsDisabledThenDoNotDumpKern auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); MockProgram program(toClDeviceVector(*device)); auto kernel = std::unique_ptr(new MockKernel(&program, *kernelInfo)); - auto multiDispatchInfo = std::unique_ptr(new MockMultiDispatchInfo(kernel.get())); + auto multiDispatchInfo = std::unique_ptr(new MockMultiDispatchInfo(device.get(), kernel.get())); KernelArgPatchInfo kernelArgPatchInfo; @@ -384,7 +384,7 @@ TEST(FileLogger, GivenMdiWhenDumpingKernelArgsThenFileIsCreated) { auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); MockProgram program(toClDeviceVector(*device)); auto kernel = std::unique_ptr(new MockKernel(&program, *kernelInfo)); - auto multiDispatchInfo = std::unique_ptr(new MockMultiDispatchInfo(kernel.get())); + auto multiDispatchInfo = std::unique_ptr(new MockMultiDispatchInfo(device.get(), kernel.get())); KernelArgPatchInfo kernelArgPatchInfo;