mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-04 15:53:45 +08:00
Make local copy of EventsWaitlist for CommandComputeKernel
Change-Id: Ibbdfc6732fc254e73407605ebb26f88e5552c0e8 Signed-off-by: Dunajski, Bartosz <bartosz.dunajski@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
68d273580f
commit
23b7b9a8a8
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2017-2018 Intel Corporation
|
||||
* Copyright (C) 2017-2019 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -7,11 +7,14 @@
|
||||
|
||||
#include "test.h"
|
||||
|
||||
#include "runtime/event/user_event.h"
|
||||
#include "runtime/helpers/task_information.h"
|
||||
#include "runtime/memory_manager/internal_allocation_storage.h"
|
||||
#include "unit_tests/fixtures/device_fixture.h"
|
||||
#include "unit_tests/mocks/mock_buffer.h"
|
||||
#include "unit_tests/mocks/mock_command_queue.h"
|
||||
#include "unit_tests/mocks/mock_csr.h"
|
||||
#include "unit_tests/mocks/mock_kernel.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
@@ -84,3 +87,38 @@ TEST(CommandTest, markerSubmitWithTerminateFlagAbortsFlush) {
|
||||
auto expectedTaskCount = 0u;
|
||||
EXPECT_EQ(expectedTaskCount, completionStamp.taskCount);
|
||||
}
|
||||
|
||||
TEST(CommandTest, givenWaitlistRequestWhenCommandComputeKernelIsCreatedThenMakeLocalCopyOfWaitlist) {
|
||||
using UniqueIH = std::unique_ptr<IndirectHeap>;
|
||||
class MockCommandComputeKernel : public CommandComputeKernel {
|
||||
public:
|
||||
using CommandComputeKernel::eventsWaitlist;
|
||||
MockCommandComputeKernel(CommandQueue &commandQueue, KernelOperation *kernelResources, std::vector<Surface *> &surfaces, Kernel *kernel)
|
||||
: CommandComputeKernel(commandQueue, std::unique_ptr<KernelOperation>(kernelResources), surfaces, false, false, false, nullptr, PreemptionMode::Disabled, kernel, 0) {}
|
||||
};
|
||||
|
||||
auto device = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(platformDevices[0]));
|
||||
CommandQueue cmdQ(nullptr, device.get(), nullptr);
|
||||
MockKernelWithInternals kernel(*device);
|
||||
|
||||
IndirectHeap *ih1 = nullptr, *ih2 = nullptr, *ih3 = nullptr;
|
||||
cmdQ.allocateHeapMemory(IndirectHeap::DYNAMIC_STATE, 1, ih1);
|
||||
cmdQ.allocateHeapMemory(IndirectHeap::INDIRECT_OBJECT, 1, ih2);
|
||||
cmdQ.allocateHeapMemory(IndirectHeap::SURFACE_STATE, 1, ih3);
|
||||
auto cmdStream = new LinearStream(alignedMalloc(1, 1), 1);
|
||||
|
||||
std::vector<Surface *> surfaces;
|
||||
auto kernelOperation = new KernelOperation(std::unique_ptr<LinearStream>(cmdStream), UniqueIH(ih1), UniqueIH(ih2), UniqueIH(ih3),
|
||||
*device->getDefaultEngine().commandStreamReceiver->getInternalAllocationStorage());
|
||||
MockCommandComputeKernel command(cmdQ, kernelOperation, surfaces, kernel);
|
||||
|
||||
UserEvent event1, event2, event3;
|
||||
cl_event waitlist[] = {&event1, &event2};
|
||||
EventsRequest eventsRequest(2, waitlist, nullptr);
|
||||
command.setEventsRequest(eventsRequest);
|
||||
|
||||
waitlist[1] = &event3;
|
||||
|
||||
EXPECT_EQ(static_cast<cl_event>(&event1), command.eventsWaitlist[0]);
|
||||
EXPECT_EQ(static_cast<cl_event>(&event2), command.eventsWaitlist[1]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user