Skip to content

Commit 10c3a5e

Browse files
apply dispatch hint to blocking workload.
Change-Id: I521d237864db5a6eb0ee78a9b8495552241ba129 Signed-off-by: Lindong Wu <[email protected]>
1 parent ec87330 commit 10c3a5e

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

runtime/helpers/task_information.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,11 @@ CompletionStamp &CommandComputeKernel::submit(uint32_t taskLevel, bool terminate
220220
dispatchFlags.l3CacheSettings = L3CachingSettings::l3AndL1On;
221221
}
222222

223+
if (commandQueue.dispatchHints != 0) {
224+
dispatchFlags.engineHints = commandQueue.dispatchHints;
225+
dispatchFlags.epilogueRequired = true;
226+
}
227+
223228
DEBUG_BREAK_IF(taskLevel >= Event::eventNotReady);
224229

225230
gtpinNotifyPreFlushTask(&commandQueue);

unit_tests/helpers/task_information_tests.cpp

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,3 +287,37 @@ HWTEST_F(DispatchFlagsTests, givenCommandWithoutKernelWhenSubmitThenPassCorrectD
287287
EXPECT_EQ(mockCmdQ->isMultiEngineQueue(), mockCsr->passedDispatchFlags.multiEngineQueue);
288288
EXPECT_FALSE(mockCsr->passedDispatchFlags.epilogueRequired);
289289
}
290+
291+
HWTEST_F(DispatchFlagsTests, givenCommandComputeKernelWhenSubmitThenPassCorrectDispatchHints) {
292+
using CsrType = MockCsr1<FamilyType>;
293+
SetUpImpl<CsrType>();
294+
auto mockCmdQ = std::make_unique<MockCommandQueueHw<FamilyType>>(context.get(), device.get(), nullptr);
295+
auto mockCsr = static_cast<CsrType *>(&mockCmdQ->getGpgpuCommandStreamReceiver());
296+
297+
IndirectHeap *ih1 = nullptr, *ih2 = nullptr, *ih3 = nullptr;
298+
mockCmdQ->allocateHeapMemory(IndirectHeap::DYNAMIC_STATE, 1, ih1);
299+
mockCmdQ->allocateHeapMemory(IndirectHeap::INDIRECT_OBJECT, 1, ih2);
300+
mockCmdQ->allocateHeapMemory(IndirectHeap::SURFACE_STATE, 1, ih3);
301+
mockCmdQ->dispatchHints = 1234;
302+
303+
PreemptionMode preemptionMode = device->getPreemptionMode();
304+
auto cmdStream = new LinearStream(device->getMemoryManager()->allocateGraphicsMemoryWithProperties({1, GraphicsAllocation::AllocationType::COMMAND_BUFFER}));
305+
306+
std::vector<Surface *> surfaces;
307+
auto kernelOperation = std::make_unique<KernelOperation>(cmdStream, *mockCmdQ->getGpgpuCommandStreamReceiver().getInternalAllocationStorage());
308+
MockKernelWithInternals kernel(*device);
309+
kernelOperation->setHeaps(ih1, ih2, ih3);
310+
311+
bool flushDC = false;
312+
bool slmUsed = false;
313+
bool ndRangeKernel = false;
314+
bool requiresCoherency = false;
315+
for (auto &surface : surfaces) {
316+
requiresCoherency |= surface->IsCoherent;
317+
}
318+
std::unique_ptr<Command> command(new CommandComputeKernel(*mockCmdQ, kernelOperation, surfaces, flushDC, slmUsed, ndRangeKernel, nullptr, preemptionMode, kernel, 1));
319+
command->submit(20, false);
320+
321+
EXPECT_TRUE(mockCsr->passedDispatchFlags.epilogueRequired);
322+
EXPECT_EQ(1234u, mockCsr->passedDispatchFlags.engineHints);
323+
}

0 commit comments

Comments
 (0)