Skip to content

Commit b112de7

Browse files
author
Ewan Crawford
committed
[CUDA][HIP] Improve command-buffer sync points
Several improvements to sync-point implementation in HIP and CUDA command-buffer adapters with additional CTS coverage to back it up. * In the CUDA/HIP adapters we assume that there is always a return sync-point passed by the user. However, this is not required by the UR API, so we should check that the return value is non-null before dereferencing. * The Fill helper function is can implement as fill as several commands for certain pattern sizes, we were creating a sync point for every internal command. This is not required, these commands from a linear dependency chain, so only the leaf command is required to be a sync point for future commands to depend on. * Remove `shared_ptr` from `CUgraphNode` objects stored for sync-points. `CUgraphNode` is a pointer type, and is managed by the CUDA driver runtime rather than us. * Simplify handling of return results. We don't always use the helper macro for returning the `ur_result_t` value no a function call fail, and also often unnecessarily use a variable to store return code. * Use `hipMemcpyDefault` for USM memcopy
1 parent 25c6324 commit b112de7

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

source/adapters/cuda/command_buffer.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -699,6 +699,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendUSMPrefetchExp(
699699
uint32_t numSyncPointsInWaitList,
700700
const ur_exp_command_buffer_sync_point_t *pSyncPointWaitList,
701701
ur_exp_command_buffer_sync_point_t *pSyncPoint) {
702+
ur_result_t Result = UR_RESULT_SUCCESS;
702703
// Prefetch cmd is not supported by Cuda Graph.
703704
// We implement it as an empty node to enforce dependencies.
704705
CUgraphNode GraphNode;

0 commit comments

Comments
 (0)