mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-08 05:56:36 +08:00
Refactor pipe control post sync operations
Related-To: NEO-6262 Signed-off-by: Zbigniew Zdanowicz <zbigniew.zdanowicz@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
61641bb70a
commit
36fd163837
@@ -120,13 +120,13 @@ EngineGroupType HwHelperHw<Family>::getEngineGroupType(aub_stream::EngineType en
|
||||
}
|
||||
|
||||
template <>
|
||||
void MemorySynchronizationCommands<Family>::addPipeControlWA(LinearStream &commandStream, uint64_t gpuAddress, const HardwareInfo &hwInfo) {
|
||||
using PIPE_CONTROL = typename Family::PIPE_CONTROL;
|
||||
void MemorySynchronizationCommands<Family>::setPipeControlWA(void *&commandsBuffer, uint64_t gpuAddress, const HardwareInfo &hwInfo) {
|
||||
if (HwInfoConfig::get(hwInfo.platform.eProductFamily)->pipeControlWARequired(hwInfo)) {
|
||||
PIPE_CONTROL cmd = Family::cmdInitPipeControl;
|
||||
|
||||
cmd.setCommandStreamerStallEnable(true);
|
||||
auto pipeControl = static_cast<Family::PIPE_CONTROL *>(commandStream.getSpace(sizeof(PIPE_CONTROL)));
|
||||
*pipeControl = cmd;
|
||||
*reinterpret_cast<PIPE_CONTROL *>(commandsBuffer) = cmd;
|
||||
commandsBuffer = ptrOffset(commandsBuffer, sizeof(PIPE_CONTROL));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,13 +25,12 @@ SipKernelType HwHelperHw<Family>::getSipKernelType(bool debuggingActive) const {
|
||||
}
|
||||
|
||||
template <>
|
||||
void MemorySynchronizationCommands<Family>::addPipeControlWA(LinearStream &commandStream, uint64_t gpuAddress, const HardwareInfo &hwInfo) {
|
||||
using PIPE_CONTROL = typename Family::PIPE_CONTROL;
|
||||
void MemorySynchronizationCommands<Family>::setPipeControlWA(void *&commandsBuffer, uint64_t gpuAddress, const HardwareInfo &hwInfo) {
|
||||
PIPE_CONTROL cmd = Family::cmdInitPipeControl;
|
||||
cmd.setCommandStreamerStallEnable(true);
|
||||
|
||||
auto pipeControl = static_cast<Family::PIPE_CONTROL *>(commandStream.getSpace(sizeof(Family::PIPE_CONTROL)));
|
||||
*pipeControl = cmd;
|
||||
cmd.setCommandStreamerStallEnable(true);
|
||||
*reinterpret_cast<PIPE_CONTROL *>(commandsBuffer) = cmd;
|
||||
commandsBuffer = ptrOffset(commandsBuffer, sizeof(PIPE_CONTROL));
|
||||
}
|
||||
|
||||
template <>
|
||||
|
||||
@@ -417,16 +417,32 @@ struct MemorySynchronizationCommands {
|
||||
uint64_t immediateData,
|
||||
const HardwareInfo &hwInfo,
|
||||
PipeControlArgs &args);
|
||||
static void setPipeControlAndProgramPostSyncOperation(void *&commandsBuffer,
|
||||
POST_SYNC_OPERATION operation,
|
||||
uint64_t gpuAddress,
|
||||
uint64_t immediateData,
|
||||
const HardwareInfo &hwInfo,
|
||||
PipeControlArgs &args);
|
||||
|
||||
static void addPipeControlWithPostSync(LinearStream &commandStream,
|
||||
POST_SYNC_OPERATION operation,
|
||||
uint64_t gpuAddress,
|
||||
uint64_t immediateData,
|
||||
PipeControlArgs &args);
|
||||
static void setPipeControlWithPostSync(void *&commandsBuffer,
|
||||
POST_SYNC_OPERATION operation,
|
||||
uint64_t gpuAddress,
|
||||
uint64_t immediateData,
|
||||
PipeControlArgs &args);
|
||||
|
||||
static void setPostSyncExtraProperties(PipeControlArgs &args, const HardwareInfo &hwInfo);
|
||||
static void setPipeControl(PIPE_CONTROL &pipeControl, PipeControlArgs &args);
|
||||
|
||||
static void addPipeControlWA(LinearStream &commandStream, uint64_t gpuAddress, const HardwareInfo &hwInfo);
|
||||
static void setPipeControlWA(void *&commandsBuffer, uint64_t gpuAddress, const HardwareInfo &hwInfo);
|
||||
|
||||
static void addAdditionalSynchronization(LinearStream &commandStream, uint64_t gpuAddress, const HardwareInfo &hwInfo);
|
||||
static void setAdditionalSynchronization(void *&commandsBuffer, uint64_t gpuAddress, const HardwareInfo &hwInfo);
|
||||
|
||||
static void addPipeControl(LinearStream &commandStream, PipeControlArgs &args);
|
||||
static void addPipeControlWithCSStallOnly(LinearStream &commandStream);
|
||||
@@ -437,8 +453,9 @@ struct MemorySynchronizationCommands {
|
||||
static void setCacheFlushExtraProperties(PipeControlArgs &args);
|
||||
|
||||
static size_t getSizeForPipeControlWithPostSyncOperation(const HardwareInfo &hwInfo);
|
||||
static size_t getSizeForPipeControlWA(const HardwareInfo &hwInfo);
|
||||
static size_t getSizeForSinglePipeControl();
|
||||
static size_t getSizeForSingleSynchronization(const HardwareInfo &hwInfo);
|
||||
static size_t getSizeForSingleAdditionalSynchronization(const HardwareInfo &hwInfo);
|
||||
static size_t getSizeForAdditonalSynchronization(const HardwareInfo &hwInfo);
|
||||
static size_t getSizeForFullCacheFlush();
|
||||
|
||||
|
||||
@@ -214,13 +214,53 @@ void MemorySynchronizationCommands<GfxFamily>::addPipeControlAndProgramPostSyncO
|
||||
uint64_t immediateData,
|
||||
const HardwareInfo &hwInfo,
|
||||
PipeControlArgs &args) {
|
||||
using PIPE_CONTROL = typename GfxFamily::PIPE_CONTROL;
|
||||
addPipeControlWA(commandStream, gpuAddress, hwInfo);
|
||||
|
||||
void *commandBuffer = commandStream.getSpace(
|
||||
MemorySynchronizationCommands<GfxFamily>::getSizeForPipeControlWithPostSyncOperation(hwInfo));
|
||||
|
||||
MemorySynchronizationCommands<GfxFamily>::setPipeControlAndProgramPostSyncOperation(
|
||||
commandBuffer,
|
||||
operation,
|
||||
gpuAddress,
|
||||
immediateData,
|
||||
hwInfo,
|
||||
args);
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
void MemorySynchronizationCommands<GfxFamily>::setPipeControlAndProgramPostSyncOperation(
|
||||
void *&commandsBuffer,
|
||||
POST_SYNC_OPERATION operation,
|
||||
uint64_t gpuAddress,
|
||||
uint64_t immediateData,
|
||||
const HardwareInfo &hwInfo,
|
||||
PipeControlArgs &args) {
|
||||
|
||||
MemorySynchronizationCommands<GfxFamily>::setPipeControlWA(commandsBuffer, gpuAddress, hwInfo);
|
||||
|
||||
setPostSyncExtraProperties(args, hwInfo);
|
||||
addPipeControlWithPostSync(commandStream, operation, gpuAddress, immediateData, args);
|
||||
MemorySynchronizationCommands<GfxFamily>::setPipeControlWithPostSync(commandsBuffer, operation, gpuAddress, immediateData, args);
|
||||
|
||||
MemorySynchronizationCommands<GfxFamily>::addAdditionalSynchronization(commandStream, gpuAddress, hwInfo);
|
||||
MemorySynchronizationCommands<GfxFamily>::setAdditionalSynchronization(commandsBuffer, gpuAddress, hwInfo);
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
void MemorySynchronizationCommands<GfxFamily>::setPipeControlWithPostSync(void *&commandsBuffer,
|
||||
POST_SYNC_OPERATION operation,
|
||||
uint64_t gpuAddress,
|
||||
uint64_t immediateData,
|
||||
PipeControlArgs &args) {
|
||||
PIPE_CONTROL pipeControl = GfxFamily::cmdInitPipeControl;
|
||||
setPipeControl(pipeControl, args);
|
||||
pipeControl.setPostSyncOperation(operation);
|
||||
pipeControl.setAddress(static_cast<uint32_t>(gpuAddress & 0x0000FFFFFFFFULL));
|
||||
pipeControl.setAddressHigh(static_cast<uint32_t>(gpuAddress >> 32));
|
||||
if (operation == POST_SYNC_OPERATION::POST_SYNC_OPERATION_WRITE_IMMEDIATE_DATA) {
|
||||
pipeControl.setImmediateData(immediateData);
|
||||
}
|
||||
|
||||
*reinterpret_cast<PIPE_CONTROL *>(commandsBuffer) = pipeControl;
|
||||
commandsBuffer = ptrOffset(commandsBuffer, sizeof(PIPE_CONTROL));
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
@@ -230,19 +270,21 @@ void MemorySynchronizationCommands<GfxFamily>::addPipeControlWithPostSync(
|
||||
uint64_t gpuAddress,
|
||||
uint64_t immediateData,
|
||||
PipeControlArgs &args) {
|
||||
using PIPE_CONTROL = typename GfxFamily::PIPE_CONTROL;
|
||||
void *pipeControl = commandStream.getSpace(sizeof(PIPE_CONTROL));
|
||||
setPipeControlWithPostSync(pipeControl, operation, gpuAddress, immediateData, args);
|
||||
}
|
||||
|
||||
PIPE_CONTROL cmd = GfxFamily::cmdInitPipeControl;
|
||||
setPipeControl(cmd, args);
|
||||
cmd.setPostSyncOperation(operation);
|
||||
cmd.setAddress(static_cast<uint32_t>(gpuAddress & 0x0000FFFFFFFFULL));
|
||||
cmd.setAddressHigh(static_cast<uint32_t>(gpuAddress >> 32));
|
||||
if (operation == POST_SYNC_OPERATION::POST_SYNC_OPERATION_WRITE_IMMEDIATE_DATA) {
|
||||
cmd.setImmediateData(immediateData);
|
||||
template <typename GfxFamily>
|
||||
void MemorySynchronizationCommands<GfxFamily>::addPipeControlWA(LinearStream &commandStream, uint64_t gpuAddress, const HardwareInfo &hwInfo) {
|
||||
size_t requiredSize = MemorySynchronizationCommands<GfxFamily>::getSizeForPipeControlWA(hwInfo);
|
||||
if (requiredSize > 0) {
|
||||
void *commandBuffer = commandStream.getSpace(requiredSize);
|
||||
setPipeControlWA(commandBuffer, gpuAddress, hwInfo);
|
||||
}
|
||||
}
|
||||
|
||||
PIPE_CONTROL *pipeControl = commandStream.getSpaceForCmd<PIPE_CONTROL>();
|
||||
*pipeControl = cmd;
|
||||
template <typename GfxFamily>
|
||||
void MemorySynchronizationCommands<GfxFamily>::addAdditionalSynchronization(LinearStream &commandStream, uint64_t gpuAddress, const HardwareInfo &hwInfo) {
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
@@ -318,16 +360,28 @@ size_t MemorySynchronizationCommands<GfxFamily>::getSizeForSinglePipeControl() {
|
||||
|
||||
template <typename GfxFamily>
|
||||
size_t MemorySynchronizationCommands<GfxFamily>::getSizeForPipeControlWithPostSyncOperation(const HardwareInfo &hwInfo) {
|
||||
const auto pipeControlCount = MemorySynchronizationCommands<GfxFamily>::isPipeControlWArequired(hwInfo) ? 2u : 1u;
|
||||
return pipeControlCount * getSizeForSinglePipeControl() + getSizeForAdditonalSynchronization(hwInfo);
|
||||
size_t size = getSizeForSinglePipeControl() +
|
||||
getSizeForPipeControlWA(hwInfo) +
|
||||
getSizeForSingleAdditionalSynchronization(hwInfo);
|
||||
return size;
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
void MemorySynchronizationCommands<GfxFamily>::addAdditionalSynchronization(LinearStream &commandStream, uint64_t gpuAddress, const HardwareInfo &hwInfo) {
|
||||
size_t MemorySynchronizationCommands<GfxFamily>::getSizeForPipeControlWA(const HardwareInfo &hwInfo) {
|
||||
size_t size = 0;
|
||||
if (MemorySynchronizationCommands<GfxFamily>::isPipeControlWArequired(hwInfo)) {
|
||||
size = getSizeForSinglePipeControl() +
|
||||
getSizeForSingleAdditionalSynchronization(hwInfo);
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
inline size_t MemorySynchronizationCommands<GfxFamily>::getSizeForSingleSynchronization(const HardwareInfo &hwInfo) {
|
||||
void MemorySynchronizationCommands<GfxFamily>::setAdditionalSynchronization(void *&commandsBuffer, uint64_t gpuAddress, const HardwareInfo &hwInfo) {
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
inline size_t MemorySynchronizationCommands<GfxFamily>::getSizeForSingleAdditionalSynchronization(const HardwareInfo &hwInfo) {
|
||||
return 0u;
|
||||
}
|
||||
|
||||
|
||||
@@ -101,7 +101,7 @@ aub_stream::MMIOList HwHelperHw<GfxFamily>::getExtraMmioList(const HardwareInfo
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
inline void MemorySynchronizationCommands<GfxFamily>::addPipeControlWA(LinearStream &commandStream, uint64_t gpuAddress, const HardwareInfo &hwInfo) {
|
||||
inline void MemorySynchronizationCommands<GfxFamily>::setPipeControlWA(void *&commandsBuffer, uint64_t gpuAddress, const HardwareInfo &hwInfo) {
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
|
||||
@@ -118,17 +118,14 @@ std::string HwHelperHw<Family>::getExtensions() const {
|
||||
}
|
||||
|
||||
template <>
|
||||
void MemorySynchronizationCommands<Family>::addPipeControlWA(LinearStream &commandStream, uint64_t gpuAddress, const HardwareInfo &hwInfo) {
|
||||
using PIPE_CONTROL = typename Family::PIPE_CONTROL;
|
||||
|
||||
void MemorySynchronizationCommands<Family>::setPipeControlWA(void *&commandsBuffer, uint64_t gpuAddress, const HardwareInfo &hwInfo) {
|
||||
if (DebugManager.flags.DisablePipeControlPrecedingPostSyncCommand.get() == 1) {
|
||||
if (hwInfo.featureTable.ftrLocalMemory) {
|
||||
PIPE_CONTROL cmd = Family::cmdInitPipeControl;
|
||||
cmd.setCommandStreamerStallEnable(true);
|
||||
cmd.setHdcPipelineFlush(true);
|
||||
|
||||
auto pipeControl = static_cast<PIPE_CONTROL *>(commandStream.getSpace(sizeof(PIPE_CONTROL)));
|
||||
*pipeControl = cmd;
|
||||
*reinterpret_cast<PIPE_CONTROL *>(commandsBuffer) = cmd;
|
||||
commandsBuffer = ptrOffset(commandsBuffer, sizeof(PIPE_CONTROL));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,6 +65,8 @@ struct UnitTestHelper {
|
||||
static const bool useFullRowForLocalIdsGeneration;
|
||||
|
||||
static const bool additionalMiFlushDwRequired;
|
||||
|
||||
static uint64_t getPipeControlPostSyncAddress(const typename GfxFamily::PIPE_CONTROL &pipeControl);
|
||||
};
|
||||
|
||||
} // namespace NEO
|
||||
|
||||
@@ -105,4 +105,12 @@ const bool UnitTestHelper<GfxFamily>::useFullRowForLocalIdsGeneration = false;
|
||||
template <typename GfxFamily>
|
||||
const bool UnitTestHelper<GfxFamily>::additionalMiFlushDwRequired = false;
|
||||
|
||||
template <typename GfxFamily>
|
||||
uint64_t UnitTestHelper<GfxFamily>::getPipeControlPostSyncAddress(const typename GfxFamily::PIPE_CONTROL &pipeControl) {
|
||||
uint64_t gpuAddress = pipeControl.getAddress();
|
||||
uint64_t gpuAddressHigh = pipeControl.getAddressHigh();
|
||||
|
||||
return (gpuAddressHigh << 32) | gpuAddress;
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
|
||||
Reference in New Issue
Block a user