mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
L3 programming refactor 1/n
- Clean up size estimation functions - Make some tests gen specific Change-Id: If9c15f311306282ba035b380e6d4cadc17584815
This commit is contained in:

committed by
sys_ocldev

parent
588d982989
commit
1392b79b58
@ -52,7 +52,7 @@ class CommandStreamReceiverHw : public CommandStreamReceiver {
|
||||
void flushBatchedSubmissions() override;
|
||||
|
||||
void addPipeControl(LinearStream &commandStream, bool dcFlush) override;
|
||||
int getRequiredPipeControlSize();
|
||||
int getRequiredPipeControlSize() const;
|
||||
|
||||
static void addBatchBufferEnd(LinearStream &commandStream, void **patchLocation);
|
||||
static void addBatchBufferStart(MI_BATCH_BUFFER_START *commandBufferMemory, uint64_t startAddress);
|
||||
@ -60,6 +60,9 @@ class CommandStreamReceiverHw : public CommandStreamReceiver {
|
||||
|
||||
size_t getRequiredCmdStreamSize(const DispatchFlags &dispatchFlags);
|
||||
size_t getRequiredCmdStreamSizeAligned(const DispatchFlags &dispatchFlags);
|
||||
size_t getCmdSizeForPreemption(const DispatchFlags &dispatchFlags) const;
|
||||
size_t getCmdSizeForL3Config() const;
|
||||
size_t getCmdSizeForPipelineSelect() const;
|
||||
size_t getCmdSizeForCoherency();
|
||||
size_t getCmdSizeForMediaSampler(bool mediaSamplerRequired) const;
|
||||
void programCoherency(LinearStream &csr, DispatchFlags &dispatchFlags);
|
||||
|
@ -80,8 +80,7 @@ inline void CommandStreamReceiverHw<GfxFamily>::alignToCacheLine(LinearStream &c
|
||||
|
||||
template <typename GfxFamily>
|
||||
size_t getSizeRequiredPreambleCS(const Device &device) {
|
||||
return sizeof(typename GfxFamily::MI_LOAD_REGISTER_IMM) +
|
||||
sizeof(typename GfxFamily::PIPE_CONTROL) +
|
||||
return sizeof(typename GfxFamily::PIPE_CONTROL) +
|
||||
sizeof(typename GfxFamily::MEDIA_VFE_STATE) + PreambleHelper<GfxFamily>::getAdditionalCommandsSize(device);
|
||||
}
|
||||
|
||||
@ -102,6 +101,14 @@ void CommandStreamReceiverHw<GfxFamily>::programPipelineSelect(LinearStream &com
|
||||
}
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
inline size_t CommandStreamReceiverHw<GfxFamily>::getCmdSizeForPipelineSelect() const {
|
||||
if (csrSizeRequestFlags.mediaSamplerConfigChanged || !isPreambleSent) {
|
||||
return sizeof(typename GfxFamily::PIPELINE_SELECT);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
CompletionStamp CommandStreamReceiverHw<GfxFamily>::flushTask(
|
||||
LinearStream &commandStreamTask,
|
||||
@ -540,16 +547,13 @@ size_t CommandStreamReceiverHw<GfxFamily>::getRequiredCmdStreamSize(const Dispat
|
||||
sizeof(PIPE_CONTROL) +
|
||||
getRequiredPipeControlSize() +
|
||||
sizeof(typename GfxFamily::MI_BATCH_BUFFER_START);
|
||||
if (csrSizeRequestFlags.mediaSamplerConfigChanged || !isPreambleSent) {
|
||||
size += sizeof(typename GfxFamily::PIPELINE_SELECT);
|
||||
}
|
||||
if (csrSizeRequestFlags.l3ConfigChanged && this->isPreambleSent) {
|
||||
size += sizeof(typename GfxFamily::PIPE_CONTROL);
|
||||
}
|
||||
|
||||
size += getCmdSizeForL3Config();
|
||||
size += getCmdSizeForCoherency();
|
||||
size += getCmdSizeForMediaSampler(dispatchFlags.mediaSamplerRequired);
|
||||
size += getCmdSizeForPipelineSelect();
|
||||
size += getCmdSizeForPreemption(dispatchFlags);
|
||||
|
||||
size += PreemptionHelper::getRequiredCmdStreamSize<GfxFamily>(dispatchFlags.preemptionMode, this->lastPreemptionMode);
|
||||
if (getMemoryManager()->device->getWaTable()->waSamplerCacheFlushBetweenRedescribedSurfaceReads) {
|
||||
if (this->samplerCacheFlushRequired != SamplerCacheFlushState::samplerCacheFlushNotRequired) {
|
||||
size += sizeof(typename GfxFamily::PIPE_CONTROL);
|
||||
@ -591,6 +595,11 @@ inline void CommandStreamReceiverHw<GfxFamily>::programPreemption(LinearStream &
|
||||
this->lastPreemptionMode = dispatchFlags.preemptionMode;
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
inline size_t CommandStreamReceiverHw<GfxFamily>::getCmdSizeForPreemption(const DispatchFlags &dispatchFlags) const {
|
||||
return PreemptionHelper::getRequiredCmdStreamSize<GfxFamily>(dispatchFlags.preemptionMode, this->lastPreemptionMode);
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
inline void CommandStreamReceiverHw<GfxFamily>::programL3(LinearStream &csr, DispatchFlags &dispatchFlags, uint32_t &newL3Config) {
|
||||
typedef typename GfxFamily::PIPE_CONTROL PIPE_CONTROL;
|
||||
@ -606,6 +615,16 @@ inline void CommandStreamReceiverHw<GfxFamily>::programL3(LinearStream &csr, Dis
|
||||
}
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
inline size_t CommandStreamReceiverHw<GfxFamily>::getCmdSizeForL3Config() const {
|
||||
if (!this->isPreambleSent) {
|
||||
return sizeof(typename GfxFamily::MI_LOAD_REGISTER_IMM);
|
||||
} else if (csrSizeRequestFlags.l3ConfigChanged) {
|
||||
return sizeof(typename GfxFamily::MI_LOAD_REGISTER_IMM) + sizeof(typename GfxFamily::PIPE_CONTROL);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
inline void CommandStreamReceiverHw<GfxFamily>::programPreamble(LinearStream &csr, DispatchFlags &dispatchFlags, uint32_t &newL3Config) {
|
||||
if (!this->isPreambleSent) {
|
||||
|
@ -43,7 +43,7 @@ void CommandStreamReceiverHw<Family>::addPipeControlWA(LinearStream &commandStre
|
||||
}
|
||||
|
||||
template <>
|
||||
int CommandStreamReceiverHw<Family>::getRequiredPipeControlSize() {
|
||||
int CommandStreamReceiverHw<Family>::getRequiredPipeControlSize() const {
|
||||
return 1 * sizeof(Family::PIPE_CONTROL);
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ void CommandStreamReceiverHw<Family>::addPipeControlWA(LinearStream &commandStre
|
||||
}
|
||||
|
||||
template <>
|
||||
int CommandStreamReceiverHw<Family>::getRequiredPipeControlSize() {
|
||||
int CommandStreamReceiverHw<Family>::getRequiredPipeControlSize() const {
|
||||
return 2 * sizeof(Family::PIPE_CONTROL);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user