refactor: debug flag to print DirectSubmission semaphore usage

Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
Bartosz Dunajski
2024-08-16 12:11:18 +00:00
committed by Compute-Runtime-Automation
parent f90a6f3798
commit 85a42162f8
4 changed files with 36 additions and 1 deletions

View File

@@ -436,6 +436,7 @@ DECLARE_DEBUG_VARIABLE(int32_t, DirectSubmissionRelaxedOrderingForBcs, -1, "-1:
DECLARE_DEBUG_VARIABLE(int32_t, DirectSubmissionRelaxedOrderingQueueSizeLimit, -1, "-1: default, >0: Max gpu queue size. If limit is reached, scheduler wont consume new work")
DECLARE_DEBUG_VARIABLE(int32_t, DirectSubmissionRelaxedOrderingMinNumberOfClients, -1, "-1: default, >0: Enables RelaxedOrdering mode only if specified number of clients is assigned to given CSR.")
DECLARE_DEBUG_VARIABLE(int32_t, DirectSubmissionMonitorFenceInputPolicy, -1, "-1: default, 0: stalling command flag, 1: explicit monitor fence flag. Selects policy to dispatch monitor fence upon input flag, either for every stalling command or explicit motor fence dispatch")
DECLARE_DEBUG_VARIABLE(int32_t, DirectSubmissionPrintSemaphoreUsage, -1, "-1: default, 0: disabled, 1: enabled. If set, print DirectSubmission semaphore programming and unlocking")
DECLARE_DEBUG_VARIABLE(bool, DirectSubmissionPrintBuffers, false, "Print address of submitted command buffers")
DECLARE_DEBUG_VARIABLE(int32_t, WaitForPagingFenceInController, -1, "Instead of waiting for paging fence on user thread, program additional semaphore which will be signaled by direct submission controller when paging fence reaches required value -1: default, 0 - disable, 1 - enable.")

View File

@@ -86,7 +86,7 @@ DirectSubmissionHw<GfxFamily, Dispatcher>::DirectSubmissionHw(const DirectSubmis
int32_t disableCacheFlushKey = debugManager.flags.DirectSubmissionDisableCpuCacheFlush.get();
if (disableCacheFlushKey != -1) {
disableCpuCacheFlush = disableCacheFlushKey == 1 ? true : false;
disableCpuCacheFlush = (disableCacheFlushKey == 1);
}
isDisablePrefetcherRequired = productHelper.isPrefetcherDisablingInDirectSubmissionRequired();
@@ -430,6 +430,10 @@ inline void DirectSubmissionHw<GfxFamily, Dispatcher>::unblockGpu() {
*this->pciBarrierPtr = 0u;
}
if (debugManager.flags.DirectSubmissionPrintSemaphoreUsage.get() == 1) {
printf("DirectSubmission semaphore %" PRIx64 " unlocked with value: %u\n", semaphoreGpuVa, currentQueueWorkCount);
}
semaphoreData->queueWorkCount = currentQueueWorkCount;
if (sfenceMode == DirectSubmissionSfenceMode::beforeAndAfterSemaphore) {
@@ -547,6 +551,10 @@ template <typename GfxFamily, typename Dispatcher>
inline void DirectSubmissionHw<GfxFamily, Dispatcher>::dispatchSemaphoreSection(uint32_t value) {
using COMPARE_OPERATION = typename GfxFamily::MI_SEMAPHORE_WAIT::COMPARE_OPERATION;
if (debugManager.flags.DirectSubmissionPrintSemaphoreUsage.get() == 1) {
printf("DirectSubmission semaphore %" PRIx64 " programmed with value: %u\n", semaphoreGpuVa, value);
}
dispatchDisablePrefetcher(true);
if (this->relaxedOrderingEnabled && this->relaxedOrderingSchedulerRequired) {

View File

@@ -624,4 +624,5 @@ StandaloneInOrderTimestampAllocationEnabled = -1
ForceComputeWalkerPostSyncFlushWithWrite = -1
DeferStateInitSubmissionToFirstRegularUsage = -1
WaitForPagingFenceInController = -1
DirectSubmissionPrintSemaphoreUsage = -1
# Please don't edit below this line

View File

@@ -787,6 +787,31 @@ HWTEST_F(DirectSubmissionDispatchBufferTest, givenDirectSubmissionPrintBuffersWh
EXPECT_TRUE(pos != std::string::npos);
}
HWTEST_F(DirectSubmissionDispatchBufferTest, givenDirectSubmissionPrintSemaphoreWhenDispatchingThenPrintAllData) {
DebugManagerStateRestore restorer;
debugManager.flags.DirectSubmissionPrintSemaphoreUsage.set(1);
FlushStampTracker flushStamp(true);
MockDirectSubmissionHw<FamilyType, RenderDispatcher<FamilyType>> directSubmission(*pDevice->getDefaultEngine().commandStreamReceiver);
testing::internal::CaptureStdout();
bool ret = directSubmission.initialize(false, false);
EXPECT_TRUE(ret);
ret = directSubmission.dispatchCommandBuffer(batchBuffer, flushStamp);
EXPECT_TRUE(ret);
directSubmission.unblockGpu();
std::string output = testing::internal::GetCapturedStdout();
auto pos = output.find("DirectSubmission semaphore");
EXPECT_TRUE(pos != std::string::npos);
pos = output.find("unlocked with value:");
EXPECT_TRUE(pos != std::string::npos);
pos = output.find("programmed with value:");
EXPECT_TRUE(pos != std::string::npos);
}
HWCMDTEST_F(IGFX_XE_HP_CORE, DirectSubmissionDispatchBufferTest,
givenDirectSubmissionRingStartWhenMultiTileSupportedThenExpectMultiTileConfigSetAndWorkPartitionResident) {
using MI_LOAD_REGISTER_IMM = typename FamilyType::MI_LOAD_REGISTER_IMM;