Add helper for encoding memory prefetch

Change-Id: I481ec11b66ad392ba9748bb5bbb6fd0ad3ce7f12
Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
Bartosz Dunajski
2020-04-03 17:38:09 +02:00
parent 62a87f644c
commit 32e1b7d1a7
7 changed files with 26 additions and 0 deletions

View File

@@ -230,4 +230,10 @@ struct EncodeMiFlushDW {
static size_t getMiFlushDwCmdSizeForDataWrite();
static size_t getMiFlushDwWaSize();
};
template <typename GfxFamily>
struct EncodeMemoryPrefetch {
static void programMemoryPrefetch(LinearStream &commandStream, uint64_t gpuVa, uint32_t size);
static size_t getSizeForMemoryPrefetch();
};
} // namespace NEO

View File

@@ -405,4 +405,10 @@ size_t EncodeMiFlushDW<GfxFamily>::getMiFlushDwCmdSizeForDataWrite() {
return sizeof(typename GfxFamily::MI_FLUSH_DW) + EncodeMiFlushDW<GfxFamily>::getMiFlushDwWaSize();
}
template <typename GfxFamily>
void EncodeMemoryPrefetch<GfxFamily>::programMemoryPrefetch(LinearStream &commandStream, uint64_t gpuVa, uint32_t size) {}
template <typename GfxFamily>
size_t EncodeMemoryPrefetch<GfxFamily>::getSizeForMemoryPrefetch() { return 0; }
} // namespace NEO

View File

@@ -31,4 +31,5 @@ template struct EncodeAtomic<Family>;
template struct EncodeSempahore<Family>;
template struct EncodeBatchBufferStartOrEnd<Family>;
template struct EncodeMiFlushDW<Family>;
template struct EncodeMemoryPrefetch<Family>;
} // namespace NEO

View File

@@ -63,4 +63,5 @@ template struct EncodeSempahore<Family>;
template struct EncodeBatchBufferStartOrEnd<Family>;
template struct EncodeMiFlushDW<Family>;
template struct EncodeWA<Family>;
template struct EncodeMemoryPrefetch<Family>;
} // namespace NEO

View File

@@ -31,4 +31,5 @@ template struct EncodeAtomic<Family>;
template struct EncodeSempahore<Family>;
template struct EncodeBatchBufferStartOrEnd<Family>;
template struct EncodeMiFlushDW<Family>;
template struct EncodeMemoryPrefetch<Family>;
} // namespace NEO

View File

@@ -31,4 +31,5 @@ template struct EncodeAtomic<Family>;
template struct EncodeSempahore<Family>;
template struct EncodeBatchBufferStartOrEnd<Family>;
template struct EncodeMiFlushDW<Family>;
template struct EncodeMemoryPrefetch<Family>;
} // namespace NEO

View File

@@ -55,3 +55,13 @@ HWTEST_F(CommandEncoderTests, givenImmDataWriteWhenProgrammingMiFlushDwThenSetAl
EXPECT_EQ(gpuAddress, miFlushDwCmd->getDestinationAddress());
EXPECT_EQ(immData, miFlushDwCmd->getImmediateData());
}
HWTEST_F(CommandEncoderTests, whenEncodeMemoryPrefetchCalledThenDoNothing) {
uint8_t buffer[MemoryConstants::pageSize] = {};
LinearStream linearStream(buffer, sizeof(buffer));
EncodeMemoryPrefetch<FamilyType>::programMemoryPrefetch(linearStream, 1, 2);
EXPECT_EQ(0u, linearStream.getUsed());
EXPECT_EQ(0u, EncodeMemoryPrefetch<FamilyType>::getSizeForMemoryPrefetch());
}