Skip to content

Commit 16c186e

Browse files
krystian-andrzejewskiigcbot
authored andcommitted
Support write-sync-ret cases for typed and untyped global buffers in SynchronizationObjectCoalescing
This change is to support cases where a fence which synchronizes buffer and typed writes is proceeded by a end of thread operation. Such fences cannot be removed.
1 parent cd2cc3b commit 16c186e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

IGC/Compiler/Optimizer/SynchronizationObjectCoalescing.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -919,7 +919,7 @@ InstructionMask SynchronizationObjectCoalescingAnalysis::GetDefaultMemoryInstruc
919919
IGC_ASSERT(0);
920920
}
921921

922-
if (static_cast<uint32_t>(result & SharedMemoryWriteOperation) != 0)
922+
if (static_cast<uint32_t>(result & (SharedMemoryWriteOperation | BufferWriteOperation | TypedWriteOperation)) != 0)
923923
{
924924

925925
result = static_cast<InstructionMask>(
@@ -1285,7 +1285,8 @@ SynchronizationObjectCoalescingAnalysis::SynchronizationCaseMask Synchronization
12851285
}
12861286

12871287
// write -> fence -> ret
1288-
bool isWriteSyncRetCase = (writeBit == SharedMemoryWriteOperation) && ((localBackwardMemoryInstructionMask & writeBit) != 0 &&
1288+
bool requiresFlush = static_cast<uint32_t>(writeBit & (SharedMemoryWriteOperation | BufferWriteOperation | TypedWriteOperation)) != 0;
1289+
bool isWriteSyncRetCase = requiresFlush && ((localBackwardMemoryInstructionMask & writeBit) != 0 &&
12891290
(localForwardMemoryInstructionMask & EndOfThreadOperation) != 0);
12901291
if (isWriteSyncRetCase)
12911292
{

0 commit comments

Comments
 (0)