Skip to content

Commit fdffac3

Browse files
authored
Clarify the behaviour of urUSMMemAdvise and urUSMPrefetch when the hint is unsupported (#854)
1 parent db69f90 commit fdffac3

File tree

4 files changed

+37
-1
lines changed

4 files changed

+37
-1
lines changed

include/ur_api.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6627,6 +6627,11 @@ urEnqueueUSMMemcpy(
66276627
///////////////////////////////////////////////////////////////////////////////
66286628
/// @brief Enqueue a command to prefetch USM memory
66296629
///
6630+
/// @details
6631+
/// - Prefetching may not be supported for all devices or allocation types.
6632+
/// If memory prefetching is not supported, the prefetch hint will be
6633+
/// ignored.
6634+
///
66306635
/// @returns
66316636
/// - ::UR_RESULT_SUCCESS
66326637
/// - ::UR_RESULT_ERROR_UNINITIALIZED
@@ -6668,6 +6673,11 @@ urEnqueueUSMPrefetch(
66686673
///////////////////////////////////////////////////////////////////////////////
66696674
/// @brief Enqueue a command to set USM memory advice
66706675
///
6676+
/// @details
6677+
/// - Not all memory advice hints may be supported for all devices or
6678+
/// allocation types. If a memory advice hint is not supported, it will be
6679+
/// ignored.
6680+
///
66716681
/// @returns
66726682
/// - ::UR_RESULT_SUCCESS
66736683
/// - ::UR_RESULT_ERROR_UNINITIALIZED

scripts/core/enqueue.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1088,6 +1088,9 @@ desc: "Enqueue a command to prefetch USM memory"
10881088
class: $xEnqueue
10891089
name: USMPrefetch
10901090
ordinal: "0"
1091+
details:
1092+
- "Prefetching may not be supported for all devices or allocation types. If memory prefetching
1093+
is not supported, the prefetch hint will be ignored."
10911094
params:
10921095
- type: $x_queue_handle_t
10931096
name: hQueue
@@ -1128,10 +1131,13 @@ returns:
11281131
- $X_RESULT_ERROR_OUT_OF_RESOURCES
11291132
--- #--------------------------------------------------------------------------
11301133
type: function
1131-
desc: "Enqueue a command to set USM memory advice"
1134+
desc: "Enqueue a command to set USM memory advice"
11321135
class: $xEnqueue
11331136
name: USMAdvise
11341137
ordinal: "0"
1138+
details:
1139+
- "Not all memory advice hints may be supported for all devices or allocation types.
1140+
If a memory advice hint is not supported, it will be ignored."
11351141
params:
11361142
- type: $x_queue_handle_t
11371143
name: hQueue

source/loader/ur_libapi.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5685,6 +5685,11 @@ ur_result_t UR_APICALL urEnqueueUSMMemcpy(
56855685
///////////////////////////////////////////////////////////////////////////////
56865686
/// @brief Enqueue a command to prefetch USM memory
56875687
///
5688+
/// @details
5689+
/// - Prefetching may not be supported for all devices or allocation types.
5690+
/// If memory prefetching is not supported, the prefetch hint will be
5691+
/// ignored.
5692+
///
56885693
/// @returns
56895694
/// - ::UR_RESULT_SUCCESS
56905695
/// - ::UR_RESULT_ERROR_UNINITIALIZED
@@ -5737,6 +5742,11 @@ ur_result_t UR_APICALL urEnqueueUSMPrefetch(
57375742
///////////////////////////////////////////////////////////////////////////////
57385743
/// @brief Enqueue a command to set USM memory advice
57395744
///
5745+
/// @details
5746+
/// - Not all memory advice hints may be supported for all devices or
5747+
/// allocation types. If a memory advice hint is not supported, it will be
5748+
/// ignored.
5749+
///
57405750
/// @returns
57415751
/// - ::UR_RESULT_SUCCESS
57425752
/// - ::UR_RESULT_ERROR_UNINITIALIZED

source/ur_api.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4830,6 +4830,11 @@ ur_result_t UR_APICALL urEnqueueUSMMemcpy(
48304830
///////////////////////////////////////////////////////////////////////////////
48314831
/// @brief Enqueue a command to prefetch USM memory
48324832
///
4833+
/// @details
4834+
/// - Prefetching may not be supported for all devices or allocation types.
4835+
/// If memory prefetching is not supported, the prefetch hint will be
4836+
/// ignored.
4837+
///
48334838
/// @returns
48344839
/// - ::UR_RESULT_SUCCESS
48354840
/// - ::UR_RESULT_ERROR_UNINITIALIZED
@@ -4875,6 +4880,11 @@ ur_result_t UR_APICALL urEnqueueUSMPrefetch(
48754880
///////////////////////////////////////////////////////////////////////////////
48764881
/// @brief Enqueue a command to set USM memory advice
48774882
///
4883+
/// @details
4884+
/// - Not all memory advice hints may be supported for all devices or
4885+
/// allocation types. If a memory advice hint is not supported, it will be
4886+
/// ignored.
4887+
///
48784888
/// @returns
48794889
/// - ::UR_RESULT_SUCCESS
48804890
/// - ::UR_RESULT_ERROR_UNINITIALIZED

0 commit comments

Comments
 (0)