From 6263425cc9cfaa2031a75e5e14215dc0cf70709f Mon Sep 17 00:00:00 2001 From: Maciej Plewka Date: Tue, 18 Feb 2025 15:13:24 +0000 Subject: [PATCH] fix: pass args to obtainCommandStream in correct order Related-To: NEO-13987 Signed-off-by: Maciej Plewka --- opencl/source/command_queue/enqueue_common.h | 2 +- .../enqueue_kernel_event_tests.cpp | 31 ++++++++++++++++++- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/opencl/source/command_queue/enqueue_common.h b/opencl/source/command_queue/enqueue_common.h index 5f8d11d9a9..0abad5ef3c 100644 --- a/opencl/source/command_queue/enqueue_common.h +++ b/opencl/source/command_queue/enqueue_common.h @@ -238,7 +238,7 @@ cl_int CommandQueueHw::enqueueHandler(Surface **surfacesForResidency, } auto &commandStream = *obtainCommandStream(csrDeps, false, blockQueue, multiDispatchInfo, eventsRequest, - blockedCommandsData, surfacesForResidency, numSurfaceForResidency, canUsePipeControlInsteadOfSemaphoresForOnCsrDependencies, isFlushWithPostSyncWrite); + blockedCommandsData, surfacesForResidency, numSurfaceForResidency, isFlushWithPostSyncWrite, canUsePipeControlInsteadOfSemaphoresForOnCsrDependencies); auto commandStreamStart = commandStream.getUsed(); if (canUsePipeControlInsteadOfSemaphoresForOnCsrDependencies) { diff --git a/opencl/test/unit_test/command_queue/enqueue_kernel_event_tests.cpp b/opencl/test/unit_test/command_queue/enqueue_kernel_event_tests.cpp index ea4968c4f0..bd5d0f1f66 100644 --- a/opencl/test/unit_test/command_queue/enqueue_kernel_event_tests.cpp +++ b/opencl/test/unit_test/command_queue/enqueue_kernel_event_tests.cpp @@ -1,13 +1,17 @@ /* - * Copyright (C) 2018-2023 Intel Corporation + * Copyright (C) 2018-2025 Intel Corporation * * SPDX-License-Identifier: MIT * */ +#include "shared/test/common/cmd_parse/hw_parse.h" + #include "opencl/source/command_queue/command_queue.h" #include "opencl/source/event/event.h" +#include "opencl/source/event/user_event.h" #include "opencl/test/unit_test/fixtures/hello_world_fixture.h" +#include "opencl/test/unit_test/mocks/mock_command_queue.h" #include "gtest/gtest.h" @@ -230,3 +234,28 @@ TEST_F(EventTests, WhenEnqueuingMarkerThenPassedEventHasTheSameLevelAsPreviousCo clReleaseEvent(event); clReleaseEvent(event2); } + +HWTEST_F(EventTests, givenEnqueueKernelBlockedOnserEventWhenEnqueueHasOutEventWithProfilingThenPCisProgrammed) { + using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL; + + MockKernelWithInternals mockKernelWithInternals(*pClDevice); + MockKernel *kernel = mockKernelWithInternals.mockKernel; + UserEvent userEvent; + cl_event userEventWaitlist[] = {&userEvent}; + cl_event outEvent; + auto ccsStart = pCmdQ->getGpgpuCommandStreamReceiver().getCS().getUsed(); + auto mockCmdQueue = static_cast *>(pCmdQ); + mockCmdQueue->commandQueueProperties |= CL_QUEUE_PROFILING_ENABLE; + EXPECT_EQ(CL_SUCCESS, pCmdQ->enqueueKernel(kernel, 1, nullptr, nullptr, nullptr, 1, userEventWaitlist, &outEvent)); + + userEvent.setStatus(CL_COMPLETE); + { + HardwareParse ccsHwParser; + ccsHwParser.parseCommands(pCmdQ->getGpgpuCommandStreamReceiver().getCS(0), ccsStart); + const auto pipeControlItor = find(ccsHwParser.cmdList.begin(), ccsHwParser.cmdList.end()); + EXPECT_NE(pipeControlItor, ccsHwParser.cmdList.end()); + } + + EXPECT_EQ(CL_SUCCESS, pCmdQ->finish()); + clReleaseEvent(outEvent); +} \ No newline at end of file