@@ -1897,18 +1897,22 @@ ur_result_t urCommandBufferAppendNativeCommandExp(
18971897 numSyncPointsInWaitList, pSyncPointWaitList, true , pSyncPoint,
18981898 ZeEventList, ZeLaunchEvent));
18991899
1900- // Barrier on all commands before user defined commands.
1901- ZE2UR_CALL (zeCommandListAppendBarrier,
1902- (ZeCommandList, nullptr , ZeEventList.size (),
1903- getPointerFromVector (ZeEventList)));
1904-
1900+ if (!CommandBuffer->IsInOrderCmdList ) {
1901+ // Barrier on all commands before user defined commands.
1902+ ZE2UR_CALL (zeCommandListAppendBarrier,
1903+ (ZeCommandList, nullptr , ZeEventList.size (),
1904+ getPointerFromVector (ZeEventList)));
1905+ }
1906+
19051907 // Call user-defined function immediately
19061908 pfnNativeCommand (pData);
1907-
1908- // Barrier on all commands after user defined commands.
1909- ZE2UR_CALL (zeCommandListAppendBarrier,
1910- (ZeCommandList, ZeLaunchEvent, 0 , nullptr ));
1911-
1909+
1910+ if (!CommandBuffer->IsInOrderCmdList ) {
1911+ // Barrier on all commands after user defined commands.
1912+ ZE2UR_CALL (zeCommandListAppendBarrier,
1913+ (ZeCommandList, ZeLaunchEvent, 0 , nullptr ));
1914+ }
1915+
19121916 return UR_RESULT_SUCCESS;
19131917}
19141918
0 commit comments