Enable sfence instruction programming for DirectSubmission dispatch

Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
Bartosz Dunajski
2022-04-06 11:32:56 +00:00
committed by Compute-Runtime-Automation
parent f4407064a4
commit 6e9c890890
3 changed files with 23 additions and 12 deletions

View File

@@ -38,6 +38,12 @@ struct TagData {
uint64_t tagValue = 0ull;
};
enum class DirectSubmissionSfenceMode : int32_t {
Disabled = 0,
BeforeSemaphoreOnly = 1,
BeforeAndAfterSemaphore = 2
};
namespace UllsDefaults {
constexpr bool defaultDisableCacheFlush = true;
constexpr bool defaultDisableMonitorFence = false;
@@ -153,6 +159,7 @@ class DirectSubmissionHw {
uint32_t workloadModeOneExpectedValue = 0u;
uint32_t activeTiles = 1u;
uint32_t postSyncOffset = 0u;
DirectSubmissionSfenceMode sfenceMode = DirectSubmissionSfenceMode::BeforeAndAfterSemaphore;
volatile uint32_t reserved = 0u;
bool ringStart = false;

View File

@@ -39,6 +39,10 @@ DirectSubmissionHw<GfxFamily, Dispatcher>::DirectSubmissionHw(Device &device,
disableCacheFlush = !!DebugManager.flags.DirectSubmissionDisableCacheFlush.get();
}
if (DebugManager.flags.DirectSubmissionInsertSfenceInstructionPriorToSubmission.get() != -1) {
sfenceMode = static_cast<DirectSubmissionSfenceMode>(DebugManager.flags.DirectSubmissionInsertSfenceInstructionPriorToSubmission.get());
}
int32_t disableCacheFlushKey = DebugManager.flags.DirectSubmissionDisableCpuCacheFlush.get();
if (disableCacheFlushKey != -1) {
disableCpuCacheFlush = disableCacheFlushKey == 1 ? true : false;
@@ -435,14 +439,14 @@ bool DirectSubmissionHw<GfxFamily, Dispatcher>::dispatchCommandBuffer(BatchBuffe
reserved = *ringBufferStart;
}
if (DebugManager.flags.DirectSubmissionInsertSfenceInstructionPriorToSubmission.get() >= 1) {
if (sfenceMode >= DirectSubmissionSfenceMode::BeforeSemaphoreOnly) {
CpuIntrinsics::sfence();
}
//unblock GPU
semaphoreData->QueueWorkCount = currentQueueWorkCount;
if (DebugManager.flags.DirectSubmissionInsertSfenceInstructionPriorToSubmission.get() == 2) {
if (sfenceMode == DirectSubmissionSfenceMode::BeforeAndAfterSemaphore) {
CpuIntrinsics::sfence();
}