mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-23 11:03:02 +08:00
Cleaned up files: opencl/source/command_queue/command_queue.h shared/source/built_ins/registry/built_ins_registry.h shared/source/kernel/kernel_descriptor.h Related-To: NEO-5548 Signed-off-by: Warchulski, Jaroslaw <jaroslaw.warchulski@intel.com>
62 lines
2.5 KiB
C++
62 lines
2.5 KiB
C++
/*
|
|
* Copyright (C) 2020-2023 Intel Corporation
|
|
*
|
|
* SPDX-License-Identifier: MIT
|
|
*
|
|
*/
|
|
|
|
#include "opencl/source/helpers/cl_preemption_helper.h"
|
|
#include "opencl/source/helpers/dispatch_info.h"
|
|
#include "opencl/test/unit_test/fixtures/cl_preemption_fixture.h"
|
|
|
|
#include "gtest/gtest.h"
|
|
|
|
using namespace NEO;
|
|
class ThreadGroupPreemptionTests : public DevicePreemptionTests {
|
|
void SetUp() override {
|
|
dbgRestore.reset(new DebugManagerStateRestore());
|
|
DebugManager.flags.ForcePreemptionMode.set(static_cast<int32_t>(PreemptionMode::ThreadGroup));
|
|
preemptionMode = PreemptionMode::ThreadGroup;
|
|
DevicePreemptionTests::SetUp();
|
|
}
|
|
};
|
|
|
|
class MidThreadPreemptionTests : public DevicePreemptionTests {
|
|
public:
|
|
void SetUp() override {
|
|
dbgRestore.reset(new DebugManagerStateRestore());
|
|
DebugManager.flags.ForcePreemptionMode.set(static_cast<int32_t>(PreemptionMode::MidThread));
|
|
preemptionMode = PreemptionMode::MidThread;
|
|
DevicePreemptionTests::SetUp();
|
|
}
|
|
};
|
|
|
|
TEST_F(ThreadGroupPreemptionTests, GivenZeroSizedMdiThenThreadGroupPreemptioIsEnabled) {
|
|
MultiDispatchInfo multiDispatchInfo;
|
|
EXPECT_EQ(PreemptionMode::ThreadGroup, ClPreemptionHelper::taskPreemptionMode(device->getDevice(), multiDispatchInfo));
|
|
}
|
|
|
|
TEST_F(ThreadGroupPreemptionTests, GivenValidKernelsInMdiThenThreadGroupPreemptioIsEnabled) {
|
|
MultiDispatchInfo multiDispatchInfo;
|
|
multiDispatchInfo.push(*dispatchInfo);
|
|
multiDispatchInfo.push(*dispatchInfo);
|
|
EXPECT_EQ(PreemptionMode::ThreadGroup, ClPreemptionHelper::taskPreemptionMode(device->getDevice(), multiDispatchInfo));
|
|
}
|
|
|
|
TEST_F(ThreadGroupPreemptionTests, GivenValidKernelsInMdiAndDisabledPremptionThenPreemptionIsDisabled) {
|
|
device->setPreemptionMode(PreemptionMode::Disabled);
|
|
MultiDispatchInfo multiDispatchInfo;
|
|
multiDispatchInfo.push(*dispatchInfo);
|
|
multiDispatchInfo.push(*dispatchInfo);
|
|
EXPECT_EQ(PreemptionMode::Disabled, ClPreemptionHelper::taskPreemptionMode(device->getDevice(), multiDispatchInfo));
|
|
}
|
|
|
|
TEST_F(MidThreadPreemptionTests, GivenMultiDispatchWithoutKernelWhenDevicePreemptionIsMidThreadThenTaskPreemptionIsMidThread) {
|
|
dispatchInfo.reset(new DispatchInfo(device.get(), nullptr, 1, Vec3<size_t>(1, 1, 1), Vec3<size_t>(1, 1, 1), Vec3<size_t>(0, 0, 0)));
|
|
|
|
MultiDispatchInfo multiDispatchInfo;
|
|
multiDispatchInfo.push(*dispatchInfo);
|
|
|
|
EXPECT_EQ(PreemptionMode::MidThread, ClPreemptionHelper::taskPreemptionMode(device->getDevice(), multiDispatchInfo));
|
|
}
|