mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-08 05:56:36 +08:00
test: add flushTaskStateless mocks
Related-To: NEO-10641 Signed-off-by: Kamil Kopryk <kamil.kopryk@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
5ccfd6f2be
commit
ee2a688323
@@ -229,6 +229,14 @@ class MockCsr1 : public CommandStreamReceiverHw<GfxFamily> {
|
|||||||
passedDispatchFlags = dispatchFlags;
|
passedDispatchFlags = dispatchFlags;
|
||||||
return CompletionStamp();
|
return CompletionStamp();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CompletionStamp flushTaskStateless(LinearStream &commandStream, size_t commandStreamStart,
|
||||||
|
const IndirectHeap *dsh, const IndirectHeap *ioh,
|
||||||
|
const IndirectHeap *ssh, TaskCountType taskLevel, DispatchFlags &dispatchFlags, Device &device) override {
|
||||||
|
passedDispatchFlags = dispatchFlags;
|
||||||
|
return CompletionStamp();
|
||||||
|
}
|
||||||
|
|
||||||
MockCsr1(ExecutionEnvironment &executionEnvironment, uint32_t rootDeviceIndex, const DeviceBitfield deviceBitfield)
|
MockCsr1(ExecutionEnvironment &executionEnvironment, uint32_t rootDeviceIndex, const DeviceBitfield deviceBitfield)
|
||||||
: CommandStreamReceiverHw<GfxFamily>::CommandStreamReceiverHw(executionEnvironment, rootDeviceIndex, deviceBitfield) {}
|
: CommandStreamReceiverHw<GfxFamily>::CommandStreamReceiverHw(executionEnvironment, rootDeviceIndex, deviceBitfield) {}
|
||||||
DispatchFlags passedDispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags();
|
DispatchFlags passedDispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags();
|
||||||
|
|||||||
@@ -221,6 +221,15 @@ class UltCommandStreamReceiver : public CommandStreamReceiverHw<GfxFamily>, publ
|
|||||||
return BaseClass::flushTask(commandStream, commandStreamStart, dsh, ioh, ssh, taskLevel, dispatchFlags, device);
|
return BaseClass::flushTask(commandStream, commandStreamStart, dsh, ioh, ssh, taskLevel, dispatchFlags, device);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CompletionStamp flushTaskStateless(LinearStream &commandStream, size_t commandStreamStart,
|
||||||
|
const IndirectHeap *dsh, const IndirectHeap *ioh, const IndirectHeap *ssh,
|
||||||
|
TaskCountType taskLevel, DispatchFlags &dispatchFlags, Device &device) override {
|
||||||
|
recordedDispatchFlags = dispatchFlags;
|
||||||
|
recordedSsh = ssh;
|
||||||
|
this->lastFlushedCommandStream = &commandStream;
|
||||||
|
return BaseClass::flushTaskStateless(commandStream, commandStreamStart, dsh, ioh, ssh, taskLevel, dispatchFlags, device);
|
||||||
|
}
|
||||||
|
|
||||||
CompletionStamp flushImmediateTask(LinearStream &immediateCommandStream,
|
CompletionStamp flushImmediateTask(LinearStream &immediateCommandStream,
|
||||||
size_t immediateCommandStreamStart,
|
size_t immediateCommandStreamStart,
|
||||||
ImmediateDispatchFlags &dispatchFlags,
|
ImmediateDispatchFlags &dispatchFlags,
|
||||||
|
|||||||
@@ -369,15 +369,20 @@ class MockCsrHw2 : public CommandStreamReceiverHw<GfxFamily> {
|
|||||||
auto completionStamp = CommandStreamReceiverHw<GfxFamily>::flushTask(commandStream, commandStreamStart,
|
auto completionStamp = CommandStreamReceiverHw<GfxFamily>::flushTask(commandStream, commandStreamStart,
|
||||||
dsh, ioh, ssh, taskLevel, dispatchFlags, device);
|
dsh, ioh, ssh, taskLevel, dispatchFlags, device);
|
||||||
|
|
||||||
if (storeFlushedTaskStream && commandStream.getUsed() > commandStreamStart) {
|
storeCommandStream(commandStream, commandStreamStart);
|
||||||
storedTaskStreamSize = commandStream.getUsed() - commandStreamStart;
|
|
||||||
// Overfetch to allow command parser verify if "big" command is programmed at the end of allocation
|
return completionStamp;
|
||||||
auto overfetchedSize = storedTaskStreamSize + MemoryConstants::cacheLineSize;
|
}
|
||||||
storedTaskStream.reset(new uint8_t[overfetchedSize]);
|
|
||||||
memset(storedTaskStream.get(), 0, overfetchedSize);
|
CompletionStamp flushTaskStateless(LinearStream &commandStream, size_t commandStreamStart,
|
||||||
memcpy_s(storedTaskStream.get(), storedTaskStreamSize,
|
const IndirectHeap *dsh, const IndirectHeap *ioh,
|
||||||
ptrOffset(commandStream.getCpuBase(), commandStreamStart), storedTaskStreamSize);
|
const IndirectHeap *ssh, TaskCountType taskLevel, DispatchFlags &dispatchFlags, Device &device) override {
|
||||||
}
|
passedDispatchFlags = dispatchFlags;
|
||||||
|
|
||||||
|
recordedCommandBuffer = std::unique_ptr<CommandBuffer>(new CommandBuffer(device));
|
||||||
|
auto completionStamp = CommandStreamReceiverHw<GfxFamily>::flushTaskStateless(commandStream, commandStreamStart,
|
||||||
|
dsh, ioh, ssh, taskLevel, dispatchFlags, device);
|
||||||
|
storeCommandStream(commandStream, commandStreamStart);
|
||||||
|
|
||||||
return completionStamp;
|
return completionStamp;
|
||||||
}
|
}
|
||||||
@@ -393,6 +398,20 @@ class MockCsrHw2 : public CommandStreamReceiverHw<GfxFamily> {
|
|||||||
programHardwareContextCalled = true;
|
programHardwareContextCalled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
void storeCommandStream(LinearStream &commandStream, size_t commandStreamStart) {
|
||||||
|
if (storeFlushedTaskStream && commandStream.getUsed() > commandStreamStart) {
|
||||||
|
storedTaskStreamSize = commandStream.getUsed() - commandStreamStart;
|
||||||
|
// Overfetch to allow command parser verify if "big" command is programmed at the end of allocation
|
||||||
|
auto overfetchedSize = storedTaskStreamSize + MemoryConstants::cacheLineSize;
|
||||||
|
storedTaskStream.reset(new uint8_t[overfetchedSize]);
|
||||||
|
memset(storedTaskStream.get(), 0, overfetchedSize);
|
||||||
|
memcpy_s(storedTaskStream.get(), storedTaskStreamSize,
|
||||||
|
ptrOffset(commandStream.getCpuBase(), commandStreamStart), storedTaskStreamSize);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
bool skipBlitCalls = false;
|
bool skipBlitCalls = false;
|
||||||
bool storeFlushedTaskStream = false;
|
bool storeFlushedTaskStream = false;
|
||||||
std::unique_ptr<uint8_t[]> storedTaskStream;
|
std::unique_ptr<uint8_t[]> storedTaskStream;
|
||||||
|
|||||||
Reference in New Issue
Block a user