Skip to content

Commit

Permalink
[UR] Add invalid size check to virtual memory
Browse files Browse the repository at this point in the history
  • Loading branch information
Petr Vesely committed Jun 29, 2023
1 parent 6cd3aac commit 6cde82d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions include/ur_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -3291,6 +3291,8 @@ typedef struct ur_physical_mem_properties_t {
/// + `NULL == hDevice`
/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER
/// + `NULL == phPhysicalMem`
/// - ::UR_RESULT_ERROR_INVALID_SIZE
/// + If size is not a multiple of ::UR_VIRTUAL_MEM_GRANULARITY_INFO_MINIMUM.
UR_APIEXPORT ur_result_t UR_APICALL
urPhysicalMemCreate(
ur_context_handle_t hContext, ///< [in] handle of the context object.
Expand Down
4 changes: 3 additions & 1 deletion scripts/core/virtual_memory.yml
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,9 @@ params:
- type: $x_physical_mem_handle_t*
name: phPhysicalMem
desc: "[out] pointer to handle of physical memory object created."

returns:
- $X_RESULT_ERROR_INVALID_SIZE:
- "If size is not a multiple of $X_VIRTUAL_MEM_GRANULARITY_INFO_MINIMUM."
--- #--------------------------------------------------------------------------
type: function
desc: "Retain a physical memory handle, increment its reference count."
Expand Down
2 changes: 2 additions & 0 deletions source/loader/ur_libapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2403,6 +2403,8 @@ ur_result_t UR_APICALL urVirtualMemGetInfo(
/// + `NULL == hDevice`
/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER
/// + `NULL == phPhysicalMem`
/// - ::UR_RESULT_ERROR_INVALID_SIZE
/// + If size is not a multiple of ::UR_VIRTUAL_MEM_GRANULARITY_INFO_MINIMUM.
ur_result_t UR_APICALL urPhysicalMemCreate(
ur_context_handle_t hContext, ///< [in] handle of the context object.
ur_device_handle_t hDevice, ///< [in] handle of the device object.
Expand Down
2 changes: 2 additions & 0 deletions source/ur_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2020,6 +2020,8 @@ ur_result_t UR_APICALL urVirtualMemGetInfo(
/// + `NULL == hDevice`
/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER
/// + `NULL == phPhysicalMem`
/// - ::UR_RESULT_ERROR_INVALID_SIZE
/// + If size is not a multiple of ::UR_VIRTUAL_MEM_GRANULARITY_INFO_MINIMUM.
ur_result_t UR_APICALL urPhysicalMemCreate(
ur_context_handle_t hContext, ///< [in] handle of the context object.
ur_device_handle_t hDevice, ///< [in] handle of the device object.
Expand Down

0 comments on commit 6cde82d

Please sign in to comment.