From 533afe472abb7bbe6f98a43442d49c4159a9f344 Mon Sep 17 00:00:00 2001 From: "Zdanowicz, Zbigniew" Date: Thu, 1 Mar 2018 22:43:04 +0100 Subject: [PATCH] Program preemption mode in Interface Descriptor Data Change-Id: I7fce731d71dd0b6dc8505ebfe45d24c65898a08b --- runtime/command_queue/dispatch_walker.h | 13 ++-- runtime/command_queue/enqueue_common.h | 6 +- runtime/command_stream/preemption.h | 6 ++ runtime/command_stream/preemption.inl | 6 +- runtime/device_queue/device_queue.cpp | 4 +- runtime/device_queue/device_queue.h | 5 +- runtime/device_queue/device_queue_hw.h | 4 +- runtime/device_queue/device_queue_hw.inl | 5 +- runtime/gen8/preemption.cpp | 1 + runtime/gen9/preemption.cpp | 2 + runtime/helpers/kernel_commands.h | 8 ++- runtime/helpers/kernel_commands.inl | 17 +++-- runtime/helpers/task_information.cpp | 9 ++- runtime/helpers/task_information.h | 10 ++- .../command_queue/dispatch_walker_tests.cpp | 67 +++++++++++++------ .../device_queue/device_queue_tests.cpp | 4 +- unit_tests/event/event_tests.cpp | 20 +++--- .../parent_kernel_dispatch_tests.cpp | 10 ++- .../scheduler_dispatch_tests.cpp | 5 +- .../submit_blocked_parent_kernel_tests.cpp | 34 +++++----- unit_tests/gen8/scheduler_dispatch_tests.cpp | 3 +- unit_tests/gen8/test_preemption.cpp | 27 ++++++++ unit_tests/gen9/test_preemption.cpp | 27 ++++++++ unit_tests/helpers/kernel_commands_tests.cpp | 18 +++-- unit_tests/kernel/kernel_slm_tests.cpp | 5 +- 25 files changed, 226 insertions(+), 90 deletions(-) diff --git a/runtime/command_queue/dispatch_walker.h b/runtime/command_queue/dispatch_walker.h index 31f2ed33de..c64d5b1335 100644 --- a/runtime/command_queue/dispatch_walker.h +++ b/runtime/command_queue/dispatch_walker.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Intel Corporation + * Copyright (c) 2017 - 2018, Intel Corporation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -433,6 +433,7 @@ void dispatchWalker( KernelOperation **blockedCommandsData, HwTimeStamps *hwTimeStamps, OCLRT::HwPerfCounter *hwPerfCounter, + PreemptionMode preemptionMode, bool blockQueue = false, unsigned int commandType = 0) { @@ -586,7 +587,8 @@ void dispatchWalker( simd, localWorkSizes, offsetInterfaceDescriptorTable, - interfaceDescriptorIndex); + interfaceDescriptorIndex, + preemptionMode); if (&dispatchInfo == &*multiDispatchInfo.begin()) { // If hwTimeStampAlloc is passed (not nullptr), then we know that profiling is enabled @@ -659,17 +661,19 @@ void dispatchWalker( KernelOperation **blockedCommandsData, HwTimeStamps *hwTimeStamps, HwPerfCounter *hwPerfCounter, + PreemptionMode preemptionMode, bool blockQueue = false) { DispatchInfo dispatchInfo(const_cast(&kernel), workDim, workItems, localWorkSizesIn, globalOffsets); dispatchWalker(commandQueue, dispatchInfo, numEventsInWaitList, eventWaitList, - blockedCommandsData, hwTimeStamps, hwPerfCounter, blockQueue); + blockedCommandsData, hwTimeStamps, hwPerfCounter, preemptionMode, blockQueue); } template void dispatchScheduler( CommandQueue &commandQueue, DeviceQueueHw &devQueueHw, + PreemptionMode preemptionMode, SchedulerKernel &scheduler) { using INTERFACE_DESCRIPTOR_DATA = typename GfxFamily::INTERFACE_DESCRIPTOR_DATA; @@ -754,7 +758,8 @@ void dispatchScheduler( simd, localWorkSizes, offsetInterfaceDescriptorTable, - interfaceDescriptorIndex); + interfaceDescriptorIndex, + preemptionMode); // Implement enabling special WA DisableLSQCROPERFforOCL if needed applyWADisableLSQCROPERFforOCL(commandStream, scheduler, true); diff --git a/runtime/command_queue/enqueue_common.h b/runtime/command_queue/enqueue_common.h index 81e8cf2e69..b97aac4027 100644 --- a/runtime/command_queue/enqueue_common.h +++ b/runtime/command_queue/enqueue_common.h @@ -183,6 +183,7 @@ void CommandQueueHw::enqueueHandler(Surface **surfacesForResidency, std::unique_ptr printfHandler; bool slmUsed = false; EngineType engineType = device->getEngineType(); + auto preemption = PreemptionHelper::taskPreemptionMode(*device, multiDispatchInfo); TakeOwnershipWrapper> queueOwnership(*this); auto blockQueue = false; @@ -244,6 +245,7 @@ void CommandQueueHw::enqueueHandler(Surface **surfacesForResidency, &blockedCommandsData, hwTimeStamps, hwPerfCounter, + preemption, blockQueue, commandType); @@ -282,6 +284,7 @@ void CommandQueueHw::enqueueHandler(Surface **surfacesForResidency, dispatchScheduler( *this, *devQueueHw, + preemption, scheduler); scheduler.makeResident(commandStreamReceiver); @@ -638,7 +641,7 @@ void CommandQueueHw::enqueueBlocked( for (auto &surface : CreateRange(surfaces, surfaceCount)) { allSurfaces.push_back(surface->duplicate()); } - + PreemptionMode preemptionMode = PreemptionHelper::taskPreemptionMode(*device, multiDispatchInfo); auto kernelOperation = std::unique_ptr(blockedCommandsData); // marking ownership auto cmd = std::unique_ptr(new CommandComputeKernel( *this, @@ -649,6 +652,7 @@ void CommandQueueHw::enqueueBlocked( slmUsed, commandType == CL_COMMAND_NDRANGE_KERNEL, std::move(printfHandler), + preemptionMode, multiDispatchInfo.begin()->getKernel(), (uint32_t)multiDispatchInfo.size())); eventBuilder->getEvent()->setCommand(std::move(cmd)); diff --git a/runtime/command_stream/preemption.h b/runtime/command_stream/preemption.h index ed2f5ab638..89104df9b3 100644 --- a/runtime/command_stream/preemption.h +++ b/runtime/command_stream/preemption.h @@ -32,6 +32,9 @@ struct MultiDispatchInfo; class PreemptionHelper { public: + template + using INTERFACE_DESCRIPTOR_DATA = typename CmdFamily::INTERFACE_DESCRIPTOR_DATA; + static PreemptionMode taskPreemptionMode(Device &device, Kernel *kernel); static PreemptionMode taskPreemptionMode(Device &device, const MultiDispatchInfo &multiDispatchInfo); static bool allowThreadGroupPreemption(Kernel *kernel, const WorkaroundTable *waTable); @@ -65,6 +68,9 @@ class PreemptionHelper { static void applyPreemptionWaCmdsEnd(LinearStream *pCommandStream, const Device &device); static PreemptionMode getDefaultPreemptionMode(const HardwareInfo &hwInfo); + + template + static void programInterfaceDescriptorDataPreemption(INTERFACE_DESCRIPTOR_DATA *idd, PreemptionMode preemptionMode); }; template diff --git a/runtime/command_stream/preemption.inl b/runtime/command_stream/preemption.inl index e4b495dbb8..614941401d 100644 --- a/runtime/command_stream/preemption.inl +++ b/runtime/command_stream/preemption.inl @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Intel Corporation + * Copyright (c) 2017 - 2018, Intel Corporation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -130,4 +130,8 @@ size_t PreemptionHelper::getRequiredPreambleSize(const Device &device) { return sizeof(typename GfxFamily::GPGPU_CSR_BASE_ADDRESS) + sizeof(typename GfxFamily::STATE_SIP); } +template +void PreemptionHelper::programInterfaceDescriptorDataPreemption(INTERFACE_DESCRIPTOR_DATA *idd, PreemptionMode preemptionMode) { +} + } // namespace OCLRT diff --git a/runtime/device_queue/device_queue.cpp b/runtime/device_queue/device_queue.cpp index 49c374ef0a..32cd53bdd9 100644 --- a/runtime/device_queue/device_queue.cpp +++ b/runtime/device_queue/device_queue.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Intel Corporation + * Copyright (c) 2017 - 2018, Intel Corporation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -173,7 +173,7 @@ void DeviceQueue::resetDeviceQueue() { return; } -void DeviceQueue::dispatchScheduler(CommandQueue &cmdQ, SchedulerKernel &scheduler) { +void DeviceQueue::dispatchScheduler(CommandQueue &cmdQ, SchedulerKernel &scheduler, PreemptionMode preemptionMode) { return; } diff --git a/runtime/device_queue/device_queue.h b/runtime/device_queue/device_queue.h index 769565d1f4..39c136f968 100644 --- a/runtime/device_queue/device_queue.h +++ b/runtime/device_queue/device_queue.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Intel Corporation + * Copyright (c) 2017 - 2018, Intel Corporation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -23,6 +23,7 @@ #pragma once #include "runtime/api/cl_types.h" #include "runtime/helpers/base_object.h" +#include "runtime/helpers/hw_info.h" #include "runtime/indirect_heap/indirect_heap.h" #include "runtime/memory_manager/graphics_allocation.h" #include "runtime/execution_model/device_enqueue.h" @@ -92,7 +93,7 @@ class DeviceQueue : public BaseObject<_device_queue> { } virtual void resetDeviceQueue(); - virtual void dispatchScheduler(CommandQueue &cmdQ, SchedulerKernel &scheduler); + virtual void dispatchScheduler(CommandQueue &cmdQ, SchedulerKernel &scheduler, PreemptionMode preemptionMode); virtual IndirectHeap *getIndirectHeap(IndirectHeap::Type type); void acquireEMCriticalSection() { diff --git a/runtime/device_queue/device_queue_hw.h b/runtime/device_queue/device_queue_hw.h index 23ca5a64ef..911c488b95 100644 --- a/runtime/device_queue/device_queue_hw.h +++ b/runtime/device_queue/device_queue_hw.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Intel Corporation + * Copyright (c) 2017 - 2018, Intel Corporation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -76,7 +76,7 @@ class DeviceQueueHw : public DeviceQueue { void addExecutionModelCleanUpSection(Kernel *parentKernel, HwTimeStamps *hwTimeStamp, uint32_t taskCount) override; void resetDeviceQueue() override; - void dispatchScheduler(CommandQueue &cmdQ, SchedulerKernel &scheduler) override; + void dispatchScheduler(CommandQueue &cmdQ, SchedulerKernel &scheduler, PreemptionMode preemptionMode) override; uint32_t getSchedulerReturnInstance() { return igilQueue->m_controls.m_SchedulerEarlyReturn; diff --git a/runtime/device_queue/device_queue_hw.inl b/runtime/device_queue/device_queue_hw.inl index 0d7c5d1fc2..d827108694 100644 --- a/runtime/device_queue/device_queue_hw.inl +++ b/runtime/device_queue/device_queue_hw.inl @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Intel Corporation + * Copyright (c) 2017 - 2018, Intel Corporation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -385,9 +385,10 @@ size_t DeviceQueueHw::setSchedulerCrossThreadData(SchedulerKernel &sc } template -void DeviceQueueHw::dispatchScheduler(CommandQueue &cmdQ, SchedulerKernel &scheduler) { +void DeviceQueueHw::dispatchScheduler(CommandQueue &cmdQ, SchedulerKernel &scheduler, PreemptionMode preemptionMode) { OCLRT::dispatchScheduler(cmdQ, *this, + preemptionMode, scheduler); return; } diff --git a/runtime/gen8/preemption.cpp b/runtime/gen8/preemption.cpp index 7ffcae2753..e5624cd5c6 100644 --- a/runtime/gen8/preemption.cpp +++ b/runtime/gen8/preemption.cpp @@ -70,5 +70,6 @@ template size_t PreemptionHelper::getRequiredCmdStreamSize(Preemption template size_t PreemptionHelper::getPreemptionWaCsSize(const Device &device); template void PreemptionHelper::applyPreemptionWaCmdsBegin(LinearStream *pCommandStream, const Device &device); template void PreemptionHelper::applyPreemptionWaCmdsEnd(LinearStream *pCommandStream, const Device &device); +template void PreemptionHelper::programInterfaceDescriptorDataPreemption(INTERFACE_DESCRIPTOR_DATA *idd, PreemptionMode preemptionMode); } // namespace OCLRT diff --git a/runtime/gen9/preemption.cpp b/runtime/gen9/preemption.cpp index a4d80b905a..aa2c34d58c 100644 --- a/runtime/gen9/preemption.cpp +++ b/runtime/gen9/preemption.cpp @@ -23,6 +23,7 @@ #include #include "runtime/built_ins/built_ins.h" +#include "runtime/command_stream/csr_definitions.h" #include "runtime/command_stream/preemption.h" #include "runtime/command_stream/preemption.inl" @@ -52,4 +53,5 @@ template size_t PreemptionHelper::getRequiredCmdStreamSize(Preemption template size_t PreemptionHelper::getPreemptionWaCsSize(const Device &device); template void PreemptionHelper::applyPreemptionWaCmdsBegin(LinearStream *pCommandStream, const Device &device); template void PreemptionHelper::applyPreemptionWaCmdsEnd(LinearStream *pCommandStream, const Device &device); +template void PreemptionHelper::programInterfaceDescriptorDataPreemption(INTERFACE_DESCRIPTOR_DATA *idd, PreemptionMode preemptionMode); } // namespace OCLRT diff --git a/runtime/helpers/kernel_commands.h b/runtime/helpers/kernel_commands.h index eb6fb0c783..9171f0faf1 100644 --- a/runtime/helpers/kernel_commands.h +++ b/runtime/helpers/kernel_commands.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Intel Corporation + * Copyright (c) 2017 - 2018, Intel Corporation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -60,7 +60,8 @@ struct KernelCommandsHelper : public PerThreadDataHelper { uint32_t numSamplers, uint32_t threadsPerThreadGroup, uint32_t sizeSlm, - bool barrierEnable); + bool barrierEnable, + PreemptionMode preemptionMode); static void sendMediaStateFlush( LinearStream &commandStream, @@ -103,7 +104,8 @@ struct KernelCommandsHelper : public PerThreadDataHelper { uint32_t simd, const size_t localWorkSize[3], const uint64_t offsetInterfaceDescriptorTable, - const uint32_t interfaceDescriptorIndex); + const uint32_t interfaceDescriptorIndex, + PreemptionMode preemptionMode); static size_t getSizeRequiredCS(); static bool isPipeControlWArequired(); diff --git a/runtime/helpers/kernel_commands.inl b/runtime/helpers/kernel_commands.inl index fae1353a98..163aef7aed 100644 --- a/runtime/helpers/kernel_commands.inl +++ b/runtime/helpers/kernel_commands.inl @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Intel Corporation + * Copyright (c) 2017 - 2018, Intel Corporation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -21,6 +21,8 @@ */ #include "runtime/command_queue/local_id_gen.h" +#include "runtime/command_stream/csr_definitions.h" +#include "runtime/command_stream/preemption.h" #include "runtime/helpers/aligned_memory.h" #include "runtime/helpers/basic_math.h" #include "runtime/helpers/dispatch_info.h" @@ -171,12 +173,13 @@ size_t KernelCommandsHelper::sendInterfaceDescriptorData( uint32_t numSamplers, uint32_t threadsPerThreadGroup, uint32_t sizeSlm, - bool barrierEnable) { + bool barrierEnable, + PreemptionMode preemptionMode) { typedef typename GfxFamily::SAMPLER_STATE SAMPLER_STATE; typedef typename GfxFamily::INTERFACE_DESCRIPTOR_DATA INTERFACE_DESCRIPTOR_DATA; // Allocate some memory for the interface descriptor - auto pInterfaceDescriptor = (INTERFACE_DESCRIPTOR_DATA *)ptrOffset(indirectHeap.getBase(), (size_t)offsetInterfaceDescriptor); + auto pInterfaceDescriptor = static_cast(ptrOffset(indirectHeap.getBase(), (size_t)offsetInterfaceDescriptor)); *pInterfaceDescriptor = GfxFamily::cmdInitInterfaceDescriptorData; // Program the kernel start pointer @@ -211,6 +214,8 @@ size_t KernelCommandsHelper::sendInterfaceDescriptorData( pInterfaceDescriptor->setSharedLocalMemorySize(programmableIDSLMSize); pInterfaceDescriptor->setBarrierEnable(barrierEnable); + PreemptionHelper::programInterfaceDescriptorDataPreemption(pInterfaceDescriptor, preemptionMode); + return (size_t)offsetInterfaceDescriptor; } @@ -326,7 +331,8 @@ size_t KernelCommandsHelper::sendIndirectState( uint32_t simd, const size_t localWorkSize[3], const uint64_t offsetInterfaceDescriptorTable, - const uint32_t interfaceDescriptorIndex) { + const uint32_t interfaceDescriptorIndex, + PreemptionMode preemptionMode) { typedef typename GfxFamily::INTERFACE_DESCRIPTOR_DATA INTERFACE_DESCRIPTOR_DATA; typedef typename GfxFamily::RENDER_SURFACE_STATE RENDER_SURFACE_STATE; @@ -410,7 +416,8 @@ size_t KernelCommandsHelper::sendIndirectState( samplerCount, threadsPerThreadGroup, kernel.slmTotalSize, - !!patchInfo.executionEnvironment->HasBarriers); + !!patchInfo.executionEnvironment->HasBarriers, + preemptionMode); // Program media state flush to set interface descriptor offset KernelCommandsHelper::sendMediaStateFlush( diff --git a/runtime/helpers/task_information.cpp b/runtime/helpers/task_information.cpp index 3ac7a36a53..ce0cff4064 100644 --- a/runtime/helpers/task_information.cpp +++ b/runtime/helpers/task_information.cpp @@ -105,7 +105,8 @@ CompletionStamp &CommandMapUnmap::submit(uint32_t taskLevel, bool terminated) { CommandComputeKernel::CommandComputeKernel(CommandQueue &commandQueue, CommandStreamReceiver &commandStreamReceiver, std::unique_ptr kernelOperation, std::vector &surfaces, - bool flushDC, bool usesSLM, bool ndRangeKernel, std::unique_ptr printfHandler, Kernel *kernel, uint32_t kernelCount) + bool flushDC, bool usesSLM, bool ndRangeKernel, std::unique_ptr printfHandler, + PreemptionMode preemptionMode, Kernel *kernel, uint32_t kernelCount) : commandQueue(commandQueue), commandStreamReceiver(commandStreamReceiver), kernelOperation(std::move(kernelOperation)), @@ -123,6 +124,7 @@ CommandComputeKernel::CommandComputeKernel(CommandQueue &commandQueue, CommandSt kernel->incRefInternal(); } this->kernelCount = kernelCount; + this->preemptionMode = preemptionMode; } CommandComputeKernel::~CommandComputeKernel() { @@ -240,7 +242,8 @@ CompletionStamp &CommandComputeKernel::submit(uint32_t taskLevel, bool terminate devQueue->dispatchScheduler( commandQueue, - scheduler); + scheduler, + preemptionMode); scheduler.makeResident(commandStreamReceiver); @@ -257,7 +260,7 @@ CompletionStamp &CommandComputeKernel::submit(uint32_t taskLevel, bool terminate dispatchFlags.requiresCoherency = requiresCoherency; dispatchFlags.lowPriority = commandQueue.getPriority() == QueuePriority::LOW; dispatchFlags.throttle = commandQueue.getThrottle(); - dispatchFlags.preemptionMode = PreemptionHelper::taskPreemptionMode(commandQueue.getDevice(), kernel); + dispatchFlags.preemptionMode = preemptionMode; DEBUG_BREAK_IF(taskLevel >= Event::eventNotReady); diff --git a/runtime/helpers/task_information.h b/runtime/helpers/task_information.h index d535f63b4c..2b5cb13a62 100644 --- a/runtime/helpers/task_information.h +++ b/runtime/helpers/task_information.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Intel Corporation + * Copyright (c) 2017 - 2018, Intel Corporation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -24,7 +24,8 @@ #include "runtime/command_stream/linear_stream.h" #include "runtime/indirect_heap/indirect_heap.h" #include "runtime/utilities/iflist.h" -#include "runtime/helpers//completion_stamp.h" +#include "runtime/helpers/completion_stamp.h" +#include "runtime/helpers/hw_info.h" #include "runtime/helpers/properties_helper.h" #include @@ -99,7 +100,9 @@ struct KernelOperation { class CommandComputeKernel : public Command { public: CommandComputeKernel(CommandQueue &commandQueue, CommandStreamReceiver &commandStreamReceiver, - std::unique_ptr kernelResources, std::vector &surfaces, bool flushDC, bool usesSLM, bool ndRangeKernel, std::unique_ptr printfHandler, Kernel *kernel = nullptr, uint32_t kernelCount = 0); + std::unique_ptr kernelResources, std::vector &surfaces, + bool flushDC, bool usesSLM, bool ndRangeKernel, std::unique_ptr printfHandler, + PreemptionMode preemptionMode, Kernel *kernel = nullptr, uint32_t kernelCount = 0); ~CommandComputeKernel() override; @@ -120,6 +123,7 @@ class CommandComputeKernel : public Command { std::unique_ptr printfHandler; Kernel *kernel; uint32_t kernelCount; + PreemptionMode preemptionMode; }; class CommandMarker : public Command { diff --git a/unit_tests/command_queue/dispatch_walker_tests.cpp b/unit_tests/command_queue/dispatch_walker_tests.cpp index 4ad33f3fc3..38c8de4f21 100644 --- a/unit_tests/command_queue/dispatch_walker_tests.cpp +++ b/unit_tests/command_queue/dispatch_walker_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Intel Corporation + * Copyright (c) 2017 - 2018, Intel Corporation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -149,7 +149,8 @@ HWTEST_F(DispatchWalkerTest, shouldntChangeCommandStreamMemory) { nullptr, nullptr, nullptr, - nullptr); + nullptr, + pDevice->getPreemptionMode()); EXPECT_EQ(commandStreamBuffer, commandStream.getBase()); EXPECT_LT(commandStreamStart, commandStream.getUsed()); @@ -195,7 +196,8 @@ HWTEST_F(DispatchWalkerTest, noLocalIdsShouldntCrash) { nullptr, nullptr, nullptr, - nullptr); + nullptr, + pDevice->getPreemptionMode()); EXPECT_EQ(commandStreamBuffer, commandStream.getBase()); EXPECT_LT(commandStreamStart, commandStream.getUsed()); @@ -222,7 +224,8 @@ HWTEST_F(DispatchWalkerTest, dataParameterWorkDimensionswithDefaultLwsAlgorithm) nullptr, nullptr, nullptr, - nullptr); + nullptr, + pDevice->getPreemptionMode()); EXPECT_EQ(dimension, *kernel.workDim); } } @@ -250,7 +253,8 @@ HWTEST_F(DispatchWalkerTest, dataParameterWorkDimensionswithSquaredLwsAlgorithm) nullptr, nullptr, nullptr, - nullptr); + nullptr, + pDevice->getPreemptionMode()); EXPECT_EQ(dimension, *kernel.workDim); } } @@ -277,7 +281,8 @@ HWTEST_F(DispatchWalkerTest, dataParameterWorkDimensionswithNDLwsAlgorithm) { nullptr, nullptr, nullptr, - nullptr); + nullptr, + pDevice->getPreemptionMode()); EXPECT_EQ(dimension, *kernel.workDim); } } @@ -305,7 +310,8 @@ HWTEST_F(DispatchWalkerTest, dataParameterWorkDimensionswithOldLwsAlgorithm) { nullptr, nullptr, nullptr, - nullptr); + nullptr, + pDevice->getPreemptionMode()); EXPECT_EQ(dimension, *kernel.workDim); } } @@ -332,7 +338,8 @@ HWTEST_F(DispatchWalkerTest, dataParameterNumWorkGroups) { nullptr, nullptr, nullptr, - nullptr); + nullptr, + pDevice->getPreemptionMode()); EXPECT_EQ(2u, *kernel.numWorkGroupsX); EXPECT_EQ(5u, *kernel.numWorkGroupsY); EXPECT_EQ(10u, *kernel.numWorkGroupsZ); @@ -361,7 +368,8 @@ HWTEST_F(DispatchWalkerTest, dataParameterNoLocalWorkSizeWithOutComputeND) { nullptr, nullptr, nullptr, - nullptr); + nullptr, + pDevice->getPreemptionMode()); EXPECT_EQ(2u, *kernel.localWorkSizeX); EXPECT_EQ(5u, *kernel.localWorkSizeY); EXPECT_EQ(1u, *kernel.localWorkSizeZ); @@ -390,7 +398,8 @@ HWTEST_F(DispatchWalkerTest, dataParameterNoLocalWorkSizeWithComputeND) { nullptr, nullptr, nullptr, - nullptr); + nullptr, + pDevice->getPreemptionMode()); EXPECT_EQ(2u, *kernel.localWorkSizeX); EXPECT_EQ(5u, *kernel.localWorkSizeY); EXPECT_EQ(10u, *kernel.localWorkSizeZ); @@ -420,7 +429,8 @@ HWTEST_F(DispatchWalkerTest, dataParameterNoLocalWorkSizeWithComputeSquared) { nullptr, nullptr, nullptr, - nullptr); + nullptr, + pDevice->getPreemptionMode()); EXPECT_EQ(2u, *kernel.localWorkSizeX); EXPECT_EQ(5u, *kernel.localWorkSizeY); EXPECT_EQ(1u, *kernel.localWorkSizeZ); @@ -450,7 +460,8 @@ HWTEST_F(DispatchWalkerTest, dataParameterNoLocalWorkSizeWithOutComputeSquaredAn nullptr, nullptr, nullptr, - nullptr); + nullptr, + pDevice->getPreemptionMode()); EXPECT_EQ(2u, *kernel.localWorkSizeX); EXPECT_EQ(5u, *kernel.localWorkSizeY); EXPECT_EQ(1u, *kernel.localWorkSizeZ); @@ -478,7 +489,8 @@ HWTEST_F(DispatchWalkerTest, dataParameterLocalWorkSize) { nullptr, nullptr, nullptr, - nullptr); + nullptr, + pDevice->getPreemptionMode()); EXPECT_EQ(1u, *kernel.localWorkSizeX); EXPECT_EQ(2u, *kernel.localWorkSizeY); EXPECT_EQ(3u, *kernel.localWorkSizeZ); @@ -509,7 +521,8 @@ HWTEST_F(DispatchWalkerTest, dataParameterLocalWorkSizes) { nullptr, nullptr, nullptr, - nullptr); + nullptr, + pDevice->getPreemptionMode()); EXPECT_EQ(1u, *kernel.localWorkSizeX); EXPECT_EQ(2u, *kernel.localWorkSizeY); EXPECT_EQ(3u, *kernel.localWorkSizeZ); @@ -543,7 +556,8 @@ HWTEST_F(DispatchWalkerTest, dataParameterLocalWorkSizeForSplitKernel) { nullptr, nullptr, nullptr, - nullptr); + nullptr, + pDevice->getPreemptionMode()); auto dispatchId = 0; for (auto &dispatchInfo : multiDispatchInfo) { @@ -584,7 +598,8 @@ HWTEST_F(DispatchWalkerTest, dataParameterLocalWorkSizesForSplitWalker) { nullptr, nullptr, nullptr, - nullptr); + nullptr, + pDevice->getPreemptionMode()); auto dispatchId = 0; for (auto &dispatchInfo : multiDispatchInfo) { @@ -629,6 +644,7 @@ HWTEST_F(DispatchWalkerTest, dispatchWalkerDoesntConsumeCommandStreamWhenQueueIs &blockedCommandsData, nullptr, nullptr, + pDevice->getPreemptionMode(), blockQueue); auto &commandStream = pCmdQ->getCS(); @@ -669,6 +685,7 @@ HWTEST_F(DispatchWalkerTest, dispatchWalkerShouldGetRequiredHeapSizesFromKernelW &blockedCommandsData, nullptr, nullptr, + pDevice->getPreemptionMode(), blockQueue); Vec3 localWorkgroupSize(workGroupSize); @@ -707,6 +724,7 @@ HWTEST_F(DispatchWalkerTest, dispatchWalkerShouldGetRequiredHeapSizesFromMdiWhen &blockedCommandsData, nullptr, nullptr, + pDevice->getPreemptionMode(), blockQueue); auto expectedSizeCS = MemoryConstants::pageSize; //can get estimated more precisely @@ -739,7 +757,8 @@ HWTEST_F(DispatchWalkerTest, dispatchWalkerWithMultipleDispatchInfo) { nullptr, nullptr, nullptr, - nullptr); + nullptr, + pDevice->getPreemptionMode()); for (auto &dispatchInfo : multiDispatchInfo) { auto &kernel = *dispatchInfo.getKernel(); @@ -770,7 +789,8 @@ HWTEST_F(DispatchWalkerTest, dispatchWalkerWithMultipleDispatchInfoCorrectlyProg nullptr, nullptr, nullptr, - nullptr); + nullptr, + pDevice->getPreemptionMode()); auto dshAfterMultiDisptach = indirectHeap.getUsed(); @@ -846,7 +866,8 @@ HWTEST_F(DispatchWalkerTest, dispatchWalkerWithMultipleDispatchInfoCorrectlyProg nullptr, nullptr, nullptr, - nullptr); + nullptr, + pDevice->getPreemptionMode()); HardwareParse hwParser; hwParser.parseCommands(cmdStream, 0); @@ -889,7 +910,8 @@ HWTEST_F(DispatchWalkerTest, dispatchWalkerWithMultipleDispatchInfoAndDifferentK nullptr, nullptr, nullptr, - nullptr); + nullptr, + pDevice->getPreemptionMode()); HardwareParse hwParser; hwParser.parseCommands(cmdStream, 0); @@ -937,7 +959,8 @@ HWTEST_F(DispatchWalkerTest, dispatchWalkerWithMultipleDispatchInfoButSameKernel nullptr, nullptr, nullptr, - nullptr); + nullptr, + pDevice->getPreemptionMode()); HardwareParse hwParser; hwParser.parseCommands(cmdStream, 0); @@ -979,7 +1002,7 @@ HWTEST_F(DispatchWalkerTest, givenMultiDispatchWhenWhitelistedRegisterForCoheren DispatchInfo di2(&kernel, 1, Vec3(1, 1, 1), Vec3(1, 1, 1), Vec3(0, 0, 0)); MockMultiDispatchInfo multiDispatchInfo(std::vector({&di1, &di2})); - dispatchWalker(*pCmdQ, multiDispatchInfo, 0, nullptr, nullptr, nullptr, nullptr); + dispatchWalker(*pCmdQ, multiDispatchInfo, 0, nullptr, nullptr, nullptr, nullptr, pDevice->getPreemptionMode()); hwParser.parseCommands(cmdStream, 0); diff --git a/unit_tests/device_queue/device_queue_tests.cpp b/unit_tests/device_queue/device_queue_tests.cpp index 4639dc04f2..677cab2aee 100644 --- a/unit_tests/device_queue/device_queue_tests.cpp +++ b/unit_tests/device_queue/device_queue_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Intel Corporation + * Copyright (c) 2017 - 2018, Intel Corporation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -322,7 +322,7 @@ TEST_F(DeviceQueueTest, dispatchScheduler) { CommandQueue cmdQ(nullptr, nullptr, 0); KernelInfo info; MockSchedulerKernel *kernel = new MockSchedulerKernel(&program, info, *device); - devQueue.dispatchScheduler(cmdQ, *kernel); + devQueue.dispatchScheduler(cmdQ, *kernel, device->getPreemptionMode()); delete kernel; } diff --git a/unit_tests/event/event_tests.cpp b/unit_tests/event/event_tests.cpp index d6eae2738f..19d53b4701 100644 --- a/unit_tests/event/event_tests.cpp +++ b/unit_tests/event/event_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Intel Corporation + * Copyright (c) 2017 - 2018, Intel Corporation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -475,9 +475,9 @@ TEST_F(InternalsEventTest, resizeCmdQueueHeapsWhenKernelOparationHeapsAreBigger) std::vector v; SurfaceMock *surface = new SurfaceMock; v.push_back(surface); - + PreemptionMode preemptionMode = pDevice->getPreemptionMode(); auto cmdComputeKernel = new CommandComputeKernel(*pCmdQ, pDevice->getCommandStreamReceiver(), - std::unique_ptr(kernelOperation), v, false, false, false, nullptr); + std::unique_ptr(kernelOperation), v, false, false, false, nullptr, preemptionMode); EXPECT_LT(cmdQueueDsh.getMaxAvailableSpace(), dsh->getMaxAvailableSpace()); EXPECT_EQ(requestedSize, ish->getMaxAvailableSpace()); @@ -512,9 +512,9 @@ TEST_F(InternalsEventTest, processBlockedCommandsKernelOperation) { std::vector v; SurfaceMock *surface = new SurfaceMock; surface->graphicsAllocation = new GraphicsAllocation((void *)0x1234, 100u); - + PreemptionMode preemptionMode = pDevice->getPreemptionMode(); v.push_back(surface); - auto cmd = new CommandComputeKernel(*pCmdQ, csr, std::unique_ptr(blockedCommandsData), v, false, false, false, nullptr); + auto cmd = new CommandComputeKernel(*pCmdQ, csr, std::unique_ptr(blockedCommandsData), v, false, false, false, nullptr, preemptionMode); event.setCommand(std::unique_ptr(cmd)); auto taskLevelBefore = csr.peekTaskLevel(); @@ -550,7 +550,8 @@ TEST_F(InternalsEventTest, processBlockedCommandsAbortKernelOperation) { std::vector v; NullSurface *surface = new NullSurface; v.push_back(surface); - auto cmd = new CommandComputeKernel(*pCmdQ, csr, std::unique_ptr(blockedCommandsData), v, false, false, false, nullptr); + PreemptionMode preemptionMode = pDevice->getPreemptionMode(); + auto cmd = new CommandComputeKernel(*pCmdQ, csr, std::unique_ptr(blockedCommandsData), v, false, false, false, nullptr, preemptionMode); event.setCommand(std::unique_ptr(cmd)); auto taskLevelBefore = csr.peekTaskLevel(); @@ -610,7 +611,8 @@ TEST_F(InternalsEventTest, givenBlockedKernelWithPrintfWhenSubmittedThenPrintOut auto &csr = pDevice->getCommandStreamReceiver(); std::vector v; - auto cmd = new CommandComputeKernel(*pCmdQ, csr, std::unique_ptr(blockedCommandsData), v, false, false, false, std::move(printfHandler), pKernel); + PreemptionMode preemptionMode = pDevice->getPreemptionMode(); + auto cmd = new CommandComputeKernel(*pCmdQ, csr, std::unique_ptr(blockedCommandsData), v, false, false, false, std::move(printfHandler), preemptionMode, pKernel); event.setCommand(std::unique_ptr(cmd)); event.submitCommand(false); @@ -1420,9 +1422,9 @@ HWTEST_F(InternalsEventTest, givenAbortedCommandWhenSubmitCalledThenDontUpdateFl using UniqueIH = std::unique_ptr; auto blockedCommandsData = new KernelOperation(std::unique_ptr(cmdStream), UniqueIH(dsh), UniqueIH(ish), UniqueIH(ioh), UniqueIH(ssh)); - + PreemptionMode preemptionMode = pDevice->getPreemptionMode(); std::vector v; - auto cmd = new CommandComputeKernel(*pCmdQ, csr, std::unique_ptr(blockedCommandsData), v, false, false, false, nullptr); + auto cmd = new CommandComputeKernel(*pCmdQ, csr, std::unique_ptr(blockedCommandsData), v, false, false, false, nullptr, preemptionMode); event->setCommand(std::unique_ptr(cmd)); FlushStamp expectedFlushStamp = 0; diff --git a/unit_tests/execution_model/parent_kernel_dispatch_tests.cpp b/unit_tests/execution_model/parent_kernel_dispatch_tests.cpp index 36b3a56d39..e152ee0022 100644 --- a/unit_tests/execution_model/parent_kernel_dispatch_tests.cpp +++ b/unit_tests/execution_model/parent_kernel_dispatch_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Intel Corporation + * Copyright (c) 2017 - 2018, Intel Corporation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -64,6 +64,7 @@ HWTEST_P(ParentKernelDispatchTest, givenParentKernelWhenQueueIsNotBlockedThenDev &blockedCommandsData, nullptr, nullptr, + pDevice->getPreemptionMode(), false); size_t dshUsedAfter = pCmdQ->getIndirectHeap(IndirectHeap::DYNAMIC_STATE).getUsed(); @@ -119,6 +120,7 @@ HWTEST_P(ParentKernelDispatchTest, givenParentKernelWhenQueueIsNotBlockedThenDef &blockedCommandsData, nullptr, nullptr, + pDevice->getPreemptionMode(), false); auto iohUsed = ioh.getUsed(); @@ -145,6 +147,7 @@ HWTEST_P(ParentKernelDispatchTest, givenParentKernelWhenQueueIsNotBlockedThenSSH &blockedCommandsData, nullptr, nullptr, + pDevice->getPreemptionMode(), false); auto &ssh = pCmdQ->getIndirectHeap(IndirectHeap::SURFACE_STATE); @@ -180,6 +183,7 @@ HWTEST_P(ParentKernelDispatchTest, givenParentKernelWhenQueueIsBlockedThenSSHSiz &blockedCommandsData, nullptr, nullptr, + pDevice->getPreemptionMode(), true); // blockQueue ASSERT_NE(nullptr, blockedCommandsData); @@ -276,6 +280,7 @@ HWTEST_F(MockParentKernelDispatch, GivenBlockedQueueWhenParentKernelIsDispatched &blockedCommandsData, nullptr, nullptr, + pDevice->getPreemptionMode(), true); // blockQueue ASSERT_NE(nullptr, blockedCommandsData); @@ -308,6 +313,7 @@ HWTEST_F(MockParentKernelDispatch, GivenParentKernelWhenDispatchedThenMediaInter &blockedCommandsData, nullptr, nullptr, + pDevice->getPreemptionMode(), false); // blockQueue LinearStream *commandStream = &pCmdQ->getCS(0); @@ -363,6 +369,7 @@ HWTEST_F(MockParentKernelDispatch, GivenUsedSSHHeapWhenParentKernelIsDispatchedT &blockedCommandsData, nullptr, nullptr, + pDevice->getPreemptionMode(), false); // blockQueue EXPECT_EQ(0u, ssh.getUsed()); @@ -397,6 +404,7 @@ HWTEST_F(MockParentKernelDispatch, GivenNotUsedSSHHeapWhenParentKernelIsDispatch &blockedCommandsData, nullptr, nullptr, + pDevice->getPreemptionMode(), false); // blockQueue EXPECT_EQ(bufferMemory, ssh.getBase()); diff --git a/unit_tests/execution_model/scheduler_dispatch_tests.cpp b/unit_tests/execution_model/scheduler_dispatch_tests.cpp index 0d89af709a..fc23583819 100644 --- a/unit_tests/execution_model/scheduler_dispatch_tests.cpp +++ b/unit_tests/execution_model/scheduler_dispatch_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Intel Corporation + * Copyright (c) 2017 - 2018, Intel Corporation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -77,6 +77,7 @@ HWTEST_F(ExecutionModelSchedulerFixture, dispatchScheduler) { dispatchScheduler( *pCmdQ, *pDevQueueHw, + pDevice->getPreemptionMode(), scheduler); EXPECT_EQ(0u, *scheduler.globalWorkOffsetX); @@ -194,6 +195,7 @@ HWTEST_F(ExecutionModelSchedulerFixture, dispatchSchedulerDoesNotUseStandardCmdQ dispatchScheduler( *pCmdQ, *pDevQueueHw, + pDevice->getPreemptionMode(), scheduler); auto &ioh = pCmdQ->getIndirectHeap(IndirectHeap::INDIRECT_OBJECT); @@ -226,6 +228,7 @@ HWTEST_F(ParentKernelCommandQueueFixture, dispatchSchedulerWithEarlyReturnSetToF dispatchScheduler( *pCmdQ, mockDevQueue, + device->getPreemptionMode(), scheduler); HardwareParse hwParser; diff --git a/unit_tests/execution_model/submit_blocked_parent_kernel_tests.cpp b/unit_tests/execution_model/submit_blocked_parent_kernel_tests.cpp index 101c5e7b76..103cc7dc6b 100644 --- a/unit_tests/execution_model/submit_blocked_parent_kernel_tests.cpp +++ b/unit_tests/execution_model/submit_blocked_parent_kernel_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Intel Corporation + * Copyright (c) 2017 - 2018, Intel Corporation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -74,9 +74,9 @@ class MockDeviceQueueHwWithCriticalSectionRelease : public DeviceQueueHwinstructionHeapSizeEM = minSizeISHForEM; blockedCommandData->surfaceStateHeapSizeEM = minSizeSSHForEM; - + PreemptionMode preemptionMode = device->getPreemptionMode(); std::vector surfaces; auto *cmdComputeKernel = new CommandComputeKernel(*pCmdQ, device->getCommandStreamReceiver(), - std::unique_ptr(blockedCommandData), surfaces, false, false, false, nullptr, parentKernel, 1); + std::unique_ptr(blockedCommandData), surfaces, false, false, false, nullptr, preemptionMode, parentKernel, 1); cmdComputeKernel->submit(0, false); @@ -174,10 +174,10 @@ HWTEST_F(ParentKernelCommandQueueFixture, givenParentKernelWhenCommandIsSubmitte blockedCommandData->instructionHeapSizeEM = minSizeISHForEM; blockedCommandData->surfaceStateHeapSizeEM = minSizeSSHForEM; - + PreemptionMode preemptionMode = device->getPreemptionMode(); std::vector surfaces; auto *cmdComputeKernel = new CommandComputeKernel(*pCmdQ, device->getCommandStreamReceiver(), - std::unique_ptr(blockedCommandData), surfaces, false, false, false, nullptr, parentKernel, 1); + std::unique_ptr(blockedCommandData), surfaces, false, false, false, nullptr, preemptionMode, parentKernel, 1); cmdComputeKernel->submit(0, false); @@ -219,10 +219,10 @@ HWTEST_F(ParentKernelCommandQueueFixture, givenParentKernelWhenCommandIsSubmitte blockedCommandData->instructionHeapSizeEM = minSizeISHForEM; blockedCommandData->surfaceStateHeapSizeEM = minSizeSSHForEM; - + PreemptionMode preemptionMode = device->getPreemptionMode(); std::vector surfaces; auto *cmdComputeKernel = new CommandComputeKernel(*pCmdQ, device->getCommandStreamReceiver(), - std::unique_ptr(blockedCommandData), surfaces, false, false, false, nullptr, parentKernel, 1); + std::unique_ptr(blockedCommandData), surfaces, false, false, false, nullptr, preemptionMode, parentKernel, 1); cmdComputeKernel->submit(0, false); @@ -259,10 +259,10 @@ HWTEST_F(ParentKernelCommandQueueFixture, givenBlockedParentKernelWithProfilingW blockedCommandData->instructionHeapSizeEM = minSizeISHForEM; blockedCommandData->surfaceStateHeapSizeEM = minSizeSSHForEM; - + PreemptionMode preemptionMode = device->getPreemptionMode(); std::vector surfaces; auto *cmdComputeKernel = new CommandComputeKernel(*pCmdQ, device->getCommandStreamReceiver(), - std::unique_ptr(blockedCommandData), surfaces, false, false, false, nullptr, parentKernel, 1); + std::unique_ptr(blockedCommandData), surfaces, false, false, false, nullptr, preemptionMode, parentKernel, 1); HwTimeStamps timestamp; @@ -302,10 +302,10 @@ HWTEST_F(ParentKernelCommandQueueFixture, givenParentKernelWhenCommandIsSubmitte blockedCommandData->instructionHeapSizeEM = minSizeISHForEM; blockedCommandData->surfaceStateHeapSizeEM = minSizeSSHForEM; - + PreemptionMode preemptionMode = device->getPreemptionMode(); std::vector surfaces; auto *cmdComputeKernel = new CommandComputeKernel(*pCmdQ, device->getCommandStreamReceiver(), - std::unique_ptr(blockedCommandData), surfaces, false, false, false, nullptr, parentKernel, 1); + std::unique_ptr(blockedCommandData), surfaces, false, false, false, nullptr, preemptionMode, parentKernel, 1); cmdComputeKernel->submit(0, false); @@ -348,10 +348,10 @@ HWTEST_F(ParentKernelCommandQueueFixture, givenUsedSSHWhenParentKernelIsSubmitte blockedCommandData->instructionHeapSizeEM = minSizeISHForEM; blockedCommandData->surfaceStateHeapSizeEM = minSizeSSHForEM; - + PreemptionMode preemptionMode = device->getPreemptionMode(); std::vector surfaces; auto *cmdComputeKernel = new CommandComputeKernel(cmdQ, device->getCommandStreamReceiver(), - std::unique_ptr(blockedCommandData), surfaces, false, false, false, nullptr, parentKernel, 1); + std::unique_ptr(blockedCommandData), surfaces, false, false, false, nullptr, preemptionMode, parentKernel, 1); cmdComputeKernel->submit(0, false); @@ -397,10 +397,10 @@ HWTEST_F(ParentKernelCommandQueueFixture, givenNotUsedSSHWhenParentKernelIsSubmi blockedCommandData->instructionHeapSizeEM = minSizeISHForEM; blockedCommandData->surfaceStateHeapSizeEM = minSizeSSHForEM; - + PreemptionMode preemptionMode = device->getPreemptionMode(); std::vector surfaces; auto *cmdComputeKernel = new CommandComputeKernel(*pCmdQ, device->getCommandStreamReceiver(), - std::unique_ptr(blockedCommandData), surfaces, false, false, false, nullptr, parentKernel, 1); + std::unique_ptr(blockedCommandData), surfaces, false, false, false, nullptr, preemptionMode, parentKernel, 1); cmdComputeKernel->submit(0, false); diff --git a/unit_tests/gen8/scheduler_dispatch_tests.cpp b/unit_tests/gen8/scheduler_dispatch_tests.cpp index 70b673a72a..a5f4903fa4 100644 --- a/unit_tests/gen8/scheduler_dispatch_tests.cpp +++ b/unit_tests/gen8/scheduler_dispatch_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Intel Corporation + * Copyright (c) 2017 - 2018, Intel Corporation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -56,6 +56,7 @@ BDWTEST_F(BdwSchedulerTest, givenCallToDispatchSchedulerWhenPipeControlWithCSSta dispatchScheduler( *pCmdQ, *pDevQueueHw, + pDevice->getPreemptionMode(), scheduler); HardwareParse hwParser; diff --git a/unit_tests/gen8/test_preemption.cpp b/unit_tests/gen8/test_preemption.cpp index 1b21f73928..859e7479ce 100644 --- a/unit_tests/gen8/test_preemption.cpp +++ b/unit_tests/gen8/test_preemption.cpp @@ -174,3 +174,30 @@ GEN8TEST_F(Gen8PreemptionTests, getPreemptionWaCsSizeMidThreadWa) { size_t size = PreemptionHelper::getPreemptionWaCsSize(*device); EXPECT_EQ(expectedSize, size); } + +GEN8TEST_F(Gen8PreemptionTests, givenInterfaceDescriptorDataWhenAnyPreemptionModeThenNoChange) { + using INTERFACE_DESCRIPTOR_DATA = typename FamilyType::INTERFACE_DESCRIPTOR_DATA; + + INTERFACE_DESCRIPTOR_DATA idd; + INTERFACE_DESCRIPTOR_DATA iddArg; + int ret; + + idd = FamilyType::cmdInitInterfaceDescriptorData; + iddArg = FamilyType::cmdInitInterfaceDescriptorData; + + PreemptionHelper::programInterfaceDescriptorDataPreemption(&iddArg, PreemptionMode::Disabled); + ret = memcmp(&idd, &iddArg, sizeof(INTERFACE_DESCRIPTOR_DATA)); + EXPECT_EQ(0, ret); + + PreemptionHelper::programInterfaceDescriptorDataPreemption(&iddArg, PreemptionMode::MidBatch); + ret = memcmp(&idd, &iddArg, sizeof(INTERFACE_DESCRIPTOR_DATA)); + EXPECT_EQ(0, ret); + + PreemptionHelper::programInterfaceDescriptorDataPreemption(&iddArg, PreemptionMode::ThreadGroup); + ret = memcmp(&idd, &iddArg, sizeof(INTERFACE_DESCRIPTOR_DATA)); + EXPECT_EQ(0, ret); + + PreemptionHelper::programInterfaceDescriptorDataPreemption(&iddArg, PreemptionMode::MidThread); + ret = memcmp(&idd, &iddArg, sizeof(INTERFACE_DESCRIPTOR_DATA)); + EXPECT_EQ(0, ret); +} diff --git a/unit_tests/gen9/test_preemption.cpp b/unit_tests/gen9/test_preemption.cpp index 3cc9b56c0b..8da376d7f0 100644 --- a/unit_tests/gen9/test_preemption.cpp +++ b/unit_tests/gen9/test_preemption.cpp @@ -514,3 +514,30 @@ GEN9TEST_F(Gen9PreemptionTests, getPreemptionWaCsSizeMidThreadWa) { size_t size = PreemptionHelper::getPreemptionWaCsSize(*device); EXPECT_EQ(expectedSize, size); } + +GEN9TEST_F(Gen9PreemptionTests, givenInterfaceDescriptorDataWhenAnyPreemptionModeThenNoChange) { + using INTERFACE_DESCRIPTOR_DATA = typename FamilyType::INTERFACE_DESCRIPTOR_DATA; + + INTERFACE_DESCRIPTOR_DATA idd; + INTERFACE_DESCRIPTOR_DATA iddArg; + int ret; + + idd = FamilyType::cmdInitInterfaceDescriptorData; + iddArg = FamilyType::cmdInitInterfaceDescriptorData; + + PreemptionHelper::programInterfaceDescriptorDataPreemption(&iddArg, PreemptionMode::Disabled); + ret = memcmp(&idd, &iddArg, sizeof(INTERFACE_DESCRIPTOR_DATA)); + EXPECT_EQ(0, ret); + + PreemptionHelper::programInterfaceDescriptorDataPreemption(&iddArg, PreemptionMode::MidBatch); + ret = memcmp(&idd, &iddArg, sizeof(INTERFACE_DESCRIPTOR_DATA)); + EXPECT_EQ(0, ret); + + PreemptionHelper::programInterfaceDescriptorDataPreemption(&iddArg, PreemptionMode::ThreadGroup); + ret = memcmp(&idd, &iddArg, sizeof(INTERFACE_DESCRIPTOR_DATA)); + EXPECT_EQ(0, ret); + + PreemptionHelper::programInterfaceDescriptorDataPreemption(&iddArg, PreemptionMode::MidThread); + ret = memcmp(&idd, &iddArg, sizeof(INTERFACE_DESCRIPTOR_DATA)); + EXPECT_EQ(0, ret); +} diff --git a/unit_tests/helpers/kernel_commands_tests.cpp b/unit_tests/helpers/kernel_commands_tests.cpp index e79d519cd1..5c2a33eaf5 100644 --- a/unit_tests/helpers/kernel_commands_tests.cpp +++ b/unit_tests/helpers/kernel_commands_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Intel Corporation + * Copyright (c) 2017 - 2018, Intel Corporation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -46,8 +46,8 @@ struct KernelCommandsTest : DeviceFixture, BuiltInFixture, ::testing::Test { - using ContextFixture::SetUp; using BuiltInFixture::SetUp; + using ContextFixture::SetUp; void SetUp() override { DeviceFixture::SetUp(); @@ -135,7 +135,7 @@ HWTEST_F(KernelCommandsTest, programInterfaceDescriptorDataResourceUsage) { size_t crossThreadDataSize = kernel->getCrossThreadDataSize(); KernelCommandsHelper::sendInterfaceDescriptorData( - indirectHeap, 0, 0, crossThreadDataSize, 64, 0, 0, 0, 1, 0 * KB, false); + indirectHeap, 0, 0, crossThreadDataSize, 64, 0, 0, 0, 1, 0 * KB, false, pDevice->getPreemptionMode()); auto usedIndirectHeapAfter = indirectHeap.getUsed(); EXPECT_EQ(sizeof(INTERFACE_DESCRIPTOR_DATA), usedIndirectHeapAfter - usedIndirectHeapBefore); @@ -272,7 +272,8 @@ HWTEST_F(KernelCommandsTest, sendIndirectStateResourceUsage) { kernel->getKernelInfo().getMaxSimdSize(), localWorkSizes, IDToffset, - 0); + 0, + pDevice->getPreemptionMode()); // It's okay these are EXPECT_GE as they're only going to be used for // estimation purposes to avoid OOM. @@ -354,7 +355,8 @@ HWTEST_F(KernelCommandsTest, usedBindingTableStatePointer) { kernel->getKernelInfo().getMaxSimdSize(), localWorkSizes, 0, - 0); + 0, + pDevice->getPreemptionMode()); EXPECT_EQ(0x00000000u, *(&bindingTableStatesPointers[0])); EXPECT_EQ(0x00000040u, *(&bindingTableStatesPointers[1])); @@ -508,7 +510,8 @@ HWTEST_F(KernelCommandsTest, usedBindingTableStatePointersForGlobalAndConstantAn pKernel->getKernelInfo().getMaxSimdSize(), localWorkSizes, 0, - 0); + 0, + pDevice->getPreemptionMode()); bti = reinterpret_cast(reinterpret_cast(ssh.getBase()) + localSshOffset + btiOffset); for (uint32_t i = 0; i < numSurfaces; ++i) { @@ -742,7 +745,8 @@ HWTEST_F(KernelCommandsTest, GivenKernelWithSamplersWhenIndirectStateIsProgramme 8, localWorkSizes, interfaceDescriptorTableOffset, - 0); + 0, + pDevice->getPreemptionMode()); bool isMemorySame = memcmp(borderColorPointer, mockDsh, borderColorSize) == 0; EXPECT_TRUE(isMemorySame); diff --git a/unit_tests/kernel/kernel_slm_tests.cpp b/unit_tests/kernel/kernel_slm_tests.cpp index c1ce2a0164..dda02425d0 100644 --- a/unit_tests/kernel/kernel_slm_tests.cpp +++ b/unit_tests/kernel/kernel_slm_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Intel Corporation + * Copyright (c) 2017 - 2018, Intel Corporation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -109,7 +109,8 @@ HWTEST_P(KernelSLMAndBarrierTest, test_SLMProgramming) { 0, 1, kernelInfo.workloadInfo.slmStaticSize, - !!executionEnvironment.HasBarriers); // Barriers Enabled + !!executionEnvironment.HasBarriers, + pDevice->getPreemptionMode()); // Barriers Enabled // add the heap base + offset uint32_t *pIdData = (uint32_t *)indirectHeap.getBase() + offsetInterfaceDescriptorData;