Skip to content

Commit 49ffd44

Browse files
hdelankswiecicki
authored andcommitted
Add ur_usm_pool_native_desc_t extension
Add extension to ur_usm_pool_desc_t structure chain that allows the user to specify a buffer and its size that should by used for pool creation.
1 parent 562ef3e commit 49ffd44

11 files changed

+1012
-886
lines changed

include/ur_api.h

+158-133
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,8 @@ typedef enum ur_structure_type_t {
522522
UR_STRUCTURE_TYPE_KERNEL_ARG_LOCAL_PROPERTIES = 33,
523523
/// ::ur_usm_alloc_location_desc_t
524524
UR_STRUCTURE_TYPE_USM_ALLOC_LOCATION_DESC = 35,
525+
/// ::ur_usm_pool_native_desc_t
526+
UR_STRUCTURE_TYPE_USM_POOL_NATIVE_DESC = 36,
525527
/// ::ur_exp_command_buffer_desc_t
526528
UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_DESC = 0x1000,
527529
/// ::ur_exp_command_buffer_update_kernel_launch_desc_t
@@ -8970,6 +8972,29 @@ typedef enum ur_exp_device_2d_block_array_capability_flag_t {
89708972
#if !defined(__GNUC__)
89718973
#pragma region async_alloc_(experimental)
89728974
#endif
8975+
///////////////////////////////////////////////////////////////////////////////
8976+
/// @brief USM native pool descriptor type
8977+
///
8978+
/// @details
8979+
/// - Specify these properties in ::urUSMPoolCreate via ::ur_usm_pool_desc_t
8980+
/// as part of a `pNext` chain.
8981+
typedef struct ur_usm_pool_native_desc_t {
8982+
/// [in] type of this structure, must be
8983+
/// ::UR_STRUCTURE_TYPE_USM_POOL_NATIVE_DESC
8984+
ur_structure_type_t stype;
8985+
/// [in][optional] pointer to extension-specific structure
8986+
const void *pNext;
8987+
/// [in] USM memory object
8988+
void *pMem;
8989+
/// [in] size of USM memory object
8990+
size_t size;
8991+
/// [in] type of USM memory object
8992+
ur_usm_type_t memType;
8993+
/// [in] device associated with the USM memory object
8994+
ur_device_handle_t device;
8995+
8996+
} ur_usm_pool_native_desc_t;
8997+
89738998
///////////////////////////////////////////////////////////////////////////////
89748999
/// @brief Enqueue USM allocation flags
89759000
typedef uint32_t ur_exp_enqueue_usm_alloc_flags_t;
@@ -13870,6 +13895,139 @@ typedef struct ur_enqueue_native_command_exp_params_t {
1387013895
ur_event_handle_t **pphEvent;
1387113896
} ur_enqueue_native_command_exp_params_t;
1387213897

13898+
///////////////////////////////////////////////////////////////////////////////
13899+
/// @brief Function parameters for urUSMHostAlloc
13900+
/// @details Each entry is a pointer to the parameter passed to the function;
13901+
/// allowing the callback the ability to modify the parameter's value
13902+
typedef struct ur_usm_host_alloc_params_t {
13903+
ur_context_handle_t *phContext;
13904+
const ur_usm_desc_t **ppUSMDesc;
13905+
ur_usm_pool_handle_t *ppool;
13906+
size_t *psize;
13907+
void ***pppMem;
13908+
} ur_usm_host_alloc_params_t;
13909+
13910+
///////////////////////////////////////////////////////////////////////////////
13911+
/// @brief Function parameters for urUSMDeviceAlloc
13912+
/// @details Each entry is a pointer to the parameter passed to the function;
13913+
/// allowing the callback the ability to modify the parameter's value
13914+
typedef struct ur_usm_device_alloc_params_t {
13915+
ur_context_handle_t *phContext;
13916+
ur_device_handle_t *phDevice;
13917+
const ur_usm_desc_t **ppUSMDesc;
13918+
ur_usm_pool_handle_t *ppool;
13919+
size_t *psize;
13920+
void ***pppMem;
13921+
} ur_usm_device_alloc_params_t;
13922+
13923+
///////////////////////////////////////////////////////////////////////////////
13924+
/// @brief Function parameters for urUSMSharedAlloc
13925+
/// @details Each entry is a pointer to the parameter passed to the function;
13926+
/// allowing the callback the ability to modify the parameter's value
13927+
typedef struct ur_usm_shared_alloc_params_t {
13928+
ur_context_handle_t *phContext;
13929+
ur_device_handle_t *phDevice;
13930+
const ur_usm_desc_t **ppUSMDesc;
13931+
ur_usm_pool_handle_t *ppool;
13932+
size_t *psize;
13933+
void ***pppMem;
13934+
} ur_usm_shared_alloc_params_t;
13935+
13936+
///////////////////////////////////////////////////////////////////////////////
13937+
/// @brief Function parameters for urUSMFree
13938+
/// @details Each entry is a pointer to the parameter passed to the function;
13939+
/// allowing the callback the ability to modify the parameter's value
13940+
typedef struct ur_usm_free_params_t {
13941+
ur_context_handle_t *phContext;
13942+
void **ppMem;
13943+
} ur_usm_free_params_t;
13944+
13945+
///////////////////////////////////////////////////////////////////////////////
13946+
/// @brief Function parameters for urUSMGetMemAllocInfo
13947+
/// @details Each entry is a pointer to the parameter passed to the function;
13948+
/// allowing the callback the ability to modify the parameter's value
13949+
typedef struct ur_usm_get_mem_alloc_info_params_t {
13950+
ur_context_handle_t *phContext;
13951+
const void **ppMem;
13952+
ur_usm_alloc_info_t *ppropName;
13953+
size_t *ppropSize;
13954+
void **ppPropValue;
13955+
size_t **ppPropSizeRet;
13956+
} ur_usm_get_mem_alloc_info_params_t;
13957+
13958+
///////////////////////////////////////////////////////////////////////////////
13959+
/// @brief Function parameters for urUSMPoolCreate
13960+
/// @details Each entry is a pointer to the parameter passed to the function;
13961+
/// allowing the callback the ability to modify the parameter's value
13962+
typedef struct ur_usm_pool_create_params_t {
13963+
ur_context_handle_t *phContext;
13964+
ur_usm_pool_desc_t **ppPoolDesc;
13965+
ur_usm_pool_handle_t **pppPool;
13966+
} ur_usm_pool_create_params_t;
13967+
13968+
///////////////////////////////////////////////////////////////////////////////
13969+
/// @brief Function parameters for urUSMPoolRetain
13970+
/// @details Each entry is a pointer to the parameter passed to the function;
13971+
/// allowing the callback the ability to modify the parameter's value
13972+
typedef struct ur_usm_pool_retain_params_t {
13973+
ur_usm_pool_handle_t *ppPool;
13974+
} ur_usm_pool_retain_params_t;
13975+
13976+
///////////////////////////////////////////////////////////////////////////////
13977+
/// @brief Function parameters for urUSMPoolRelease
13978+
/// @details Each entry is a pointer to the parameter passed to the function;
13979+
/// allowing the callback the ability to modify the parameter's value
13980+
typedef struct ur_usm_pool_release_params_t {
13981+
ur_usm_pool_handle_t *ppPool;
13982+
} ur_usm_pool_release_params_t;
13983+
13984+
///////////////////////////////////////////////////////////////////////////////
13985+
/// @brief Function parameters for urUSMPoolGetInfo
13986+
/// @details Each entry is a pointer to the parameter passed to the function;
13987+
/// allowing the callback the ability to modify the parameter's value
13988+
typedef struct ur_usm_pool_get_info_params_t {
13989+
ur_usm_pool_handle_t *phPool;
13990+
ur_usm_pool_info_t *ppropName;
13991+
size_t *ppropSize;
13992+
void **ppPropValue;
13993+
size_t **ppPropSizeRet;
13994+
} ur_usm_pool_get_info_params_t;
13995+
13996+
///////////////////////////////////////////////////////////////////////////////
13997+
/// @brief Function parameters for urUSMPitchedAllocExp
13998+
/// @details Each entry is a pointer to the parameter passed to the function;
13999+
/// allowing the callback the ability to modify the parameter's value
14000+
typedef struct ur_usm_pitched_alloc_exp_params_t {
14001+
ur_context_handle_t *phContext;
14002+
ur_device_handle_t *phDevice;
14003+
const ur_usm_desc_t **ppUSMDesc;
14004+
ur_usm_pool_handle_t *ppool;
14005+
size_t *pwidthInBytes;
14006+
size_t *pheight;
14007+
size_t *pelementSizeBytes;
14008+
void ***pppMem;
14009+
size_t **ppResultPitch;
14010+
} ur_usm_pitched_alloc_exp_params_t;
14011+
14012+
///////////////////////////////////////////////////////////////////////////////
14013+
/// @brief Function parameters for urUSMImportExp
14014+
/// @details Each entry is a pointer to the parameter passed to the function;
14015+
/// allowing the callback the ability to modify the parameter's value
14016+
typedef struct ur_usm_import_exp_params_t {
14017+
ur_context_handle_t *phContext;
14018+
void **ppMem;
14019+
size_t *psize;
14020+
} ur_usm_import_exp_params_t;
14021+
14022+
///////////////////////////////////////////////////////////////////////////////
14023+
/// @brief Function parameters for urUSMReleaseExp
14024+
/// @details Each entry is a pointer to the parameter passed to the function;
14025+
/// allowing the callback the ability to modify the parameter's value
14026+
typedef struct ur_usm_release_exp_params_t {
14027+
ur_context_handle_t *phContext;
14028+
void **ppMem;
14029+
} ur_usm_release_exp_params_t;
14030+
1387314031
///////////////////////////////////////////////////////////////////////////////
1387414032
/// @brief Function parameters for
1387514033
/// urBindlessImagesUnsampledImageHandleDestroyExp
@@ -14092,139 +14250,6 @@ typedef struct ur_bindless_images_signal_external_semaphore_exp_params_t {
1409214250
ur_event_handle_t **pphEvent;
1409314251
} ur_bindless_images_signal_external_semaphore_exp_params_t;
1409414252

14095-
///////////////////////////////////////////////////////////////////////////////
14096-
/// @brief Function parameters for urUSMHostAlloc
14097-
/// @details Each entry is a pointer to the parameter passed to the function;
14098-
/// allowing the callback the ability to modify the parameter's value
14099-
typedef struct ur_usm_host_alloc_params_t {
14100-
ur_context_handle_t *phContext;
14101-
const ur_usm_desc_t **ppUSMDesc;
14102-
ur_usm_pool_handle_t *ppool;
14103-
size_t *psize;
14104-
void ***pppMem;
14105-
} ur_usm_host_alloc_params_t;
14106-
14107-
///////////////////////////////////////////////////////////////////////////////
14108-
/// @brief Function parameters for urUSMDeviceAlloc
14109-
/// @details Each entry is a pointer to the parameter passed to the function;
14110-
/// allowing the callback the ability to modify the parameter's value
14111-
typedef struct ur_usm_device_alloc_params_t {
14112-
ur_context_handle_t *phContext;
14113-
ur_device_handle_t *phDevice;
14114-
const ur_usm_desc_t **ppUSMDesc;
14115-
ur_usm_pool_handle_t *ppool;
14116-
size_t *psize;
14117-
void ***pppMem;
14118-
} ur_usm_device_alloc_params_t;
14119-
14120-
///////////////////////////////////////////////////////////////////////////////
14121-
/// @brief Function parameters for urUSMSharedAlloc
14122-
/// @details Each entry is a pointer to the parameter passed to the function;
14123-
/// allowing the callback the ability to modify the parameter's value
14124-
typedef struct ur_usm_shared_alloc_params_t {
14125-
ur_context_handle_t *phContext;
14126-
ur_device_handle_t *phDevice;
14127-
const ur_usm_desc_t **ppUSMDesc;
14128-
ur_usm_pool_handle_t *ppool;
14129-
size_t *psize;
14130-
void ***pppMem;
14131-
} ur_usm_shared_alloc_params_t;
14132-
14133-
///////////////////////////////////////////////////////////////////////////////
14134-
/// @brief Function parameters for urUSMFree
14135-
/// @details Each entry is a pointer to the parameter passed to the function;
14136-
/// allowing the callback the ability to modify the parameter's value
14137-
typedef struct ur_usm_free_params_t {
14138-
ur_context_handle_t *phContext;
14139-
void **ppMem;
14140-
} ur_usm_free_params_t;
14141-
14142-
///////////////////////////////////////////////////////////////////////////////
14143-
/// @brief Function parameters for urUSMGetMemAllocInfo
14144-
/// @details Each entry is a pointer to the parameter passed to the function;
14145-
/// allowing the callback the ability to modify the parameter's value
14146-
typedef struct ur_usm_get_mem_alloc_info_params_t {
14147-
ur_context_handle_t *phContext;
14148-
const void **ppMem;
14149-
ur_usm_alloc_info_t *ppropName;
14150-
size_t *ppropSize;
14151-
void **ppPropValue;
14152-
size_t **ppPropSizeRet;
14153-
} ur_usm_get_mem_alloc_info_params_t;
14154-
14155-
///////////////////////////////////////////////////////////////////////////////
14156-
/// @brief Function parameters for urUSMPoolCreate
14157-
/// @details Each entry is a pointer to the parameter passed to the function;
14158-
/// allowing the callback the ability to modify the parameter's value
14159-
typedef struct ur_usm_pool_create_params_t {
14160-
ur_context_handle_t *phContext;
14161-
ur_usm_pool_desc_t **ppPoolDesc;
14162-
ur_usm_pool_handle_t **pppPool;
14163-
} ur_usm_pool_create_params_t;
14164-
14165-
///////////////////////////////////////////////////////////////////////////////
14166-
/// @brief Function parameters for urUSMPoolRetain
14167-
/// @details Each entry is a pointer to the parameter passed to the function;
14168-
/// allowing the callback the ability to modify the parameter's value
14169-
typedef struct ur_usm_pool_retain_params_t {
14170-
ur_usm_pool_handle_t *ppPool;
14171-
} ur_usm_pool_retain_params_t;
14172-
14173-
///////////////////////////////////////////////////////////////////////////////
14174-
/// @brief Function parameters for urUSMPoolRelease
14175-
/// @details Each entry is a pointer to the parameter passed to the function;
14176-
/// allowing the callback the ability to modify the parameter's value
14177-
typedef struct ur_usm_pool_release_params_t {
14178-
ur_usm_pool_handle_t *ppPool;
14179-
} ur_usm_pool_release_params_t;
14180-
14181-
///////////////////////////////////////////////////////////////////////////////
14182-
/// @brief Function parameters for urUSMPoolGetInfo
14183-
/// @details Each entry is a pointer to the parameter passed to the function;
14184-
/// allowing the callback the ability to modify the parameter's value
14185-
typedef struct ur_usm_pool_get_info_params_t {
14186-
ur_usm_pool_handle_t *phPool;
14187-
ur_usm_pool_info_t *ppropName;
14188-
size_t *ppropSize;
14189-
void **ppPropValue;
14190-
size_t **ppPropSizeRet;
14191-
} ur_usm_pool_get_info_params_t;
14192-
14193-
///////////////////////////////////////////////////////////////////////////////
14194-
/// @brief Function parameters for urUSMPitchedAllocExp
14195-
/// @details Each entry is a pointer to the parameter passed to the function;
14196-
/// allowing the callback the ability to modify the parameter's value
14197-
typedef struct ur_usm_pitched_alloc_exp_params_t {
14198-
ur_context_handle_t *phContext;
14199-
ur_device_handle_t *phDevice;
14200-
const ur_usm_desc_t **ppUSMDesc;
14201-
ur_usm_pool_handle_t *ppool;
14202-
size_t *pwidthInBytes;
14203-
size_t *pheight;
14204-
size_t *pelementSizeBytes;
14205-
void ***pppMem;
14206-
size_t **ppResultPitch;
14207-
} ur_usm_pitched_alloc_exp_params_t;
14208-
14209-
///////////////////////////////////////////////////////////////////////////////
14210-
/// @brief Function parameters for urUSMImportExp
14211-
/// @details Each entry is a pointer to the parameter passed to the function;
14212-
/// allowing the callback the ability to modify the parameter's value
14213-
typedef struct ur_usm_import_exp_params_t {
14214-
ur_context_handle_t *phContext;
14215-
void **ppMem;
14216-
size_t *psize;
14217-
} ur_usm_import_exp_params_t;
14218-
14219-
///////////////////////////////////////////////////////////////////////////////
14220-
/// @brief Function parameters for urUSMReleaseExp
14221-
/// @details Each entry is a pointer to the parameter passed to the function;
14222-
/// allowing the callback the ability to modify the parameter's value
14223-
typedef struct ur_usm_release_exp_params_t {
14224-
ur_context_handle_t *phContext;
14225-
void **ppMem;
14226-
} ur_usm_release_exp_params_t;
14227-
1422814253
///////////////////////////////////////////////////////////////////////////////
1422914254
/// @brief Function parameters for urCommandBufferCreateExp
1423014255
/// @details Each entry is a pointer to the parameter passed to the function;

include/ur_api_funcs.def

+12-12
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,18 @@ _UR_API(urEnqueueUSMFreeExp)
139139
_UR_API(urEnqueueCooperativeKernelLaunchExp)
140140
_UR_API(urEnqueueTimestampRecordingExp)
141141
_UR_API(urEnqueueNativeCommandExp)
142+
_UR_API(urUSMHostAlloc)
143+
_UR_API(urUSMDeviceAlloc)
144+
_UR_API(urUSMSharedAlloc)
145+
_UR_API(urUSMFree)
146+
_UR_API(urUSMGetMemAllocInfo)
147+
_UR_API(urUSMPoolCreate)
148+
_UR_API(urUSMPoolRetain)
149+
_UR_API(urUSMPoolRelease)
150+
_UR_API(urUSMPoolGetInfo)
151+
_UR_API(urUSMPitchedAllocExp)
152+
_UR_API(urUSMImportExp)
153+
_UR_API(urUSMReleaseExp)
142154
_UR_API(urBindlessImagesUnsampledImageHandleDestroyExp)
143155
_UR_API(urBindlessImagesSampledImageHandleDestroyExp)
144156
_UR_API(urBindlessImagesImageAllocateExp)
@@ -157,18 +169,6 @@ _UR_API(urBindlessImagesImportExternalSemaphoreExp)
157169
_UR_API(urBindlessImagesReleaseExternalSemaphoreExp)
158170
_UR_API(urBindlessImagesWaitExternalSemaphoreExp)
159171
_UR_API(urBindlessImagesSignalExternalSemaphoreExp)
160-
_UR_API(urUSMHostAlloc)
161-
_UR_API(urUSMDeviceAlloc)
162-
_UR_API(urUSMSharedAlloc)
163-
_UR_API(urUSMFree)
164-
_UR_API(urUSMGetMemAllocInfo)
165-
_UR_API(urUSMPoolCreate)
166-
_UR_API(urUSMPoolRetain)
167-
_UR_API(urUSMPoolRelease)
168-
_UR_API(urUSMPoolGetInfo)
169-
_UR_API(urUSMPitchedAllocExp)
170-
_UR_API(urUSMImportExp)
171-
_UR_API(urUSMReleaseExp)
172172
_UR_API(urCommandBufferCreateExp)
173173
_UR_API(urCommandBufferRetainExp)
174174
_UR_API(urCommandBufferReleaseExp)

0 commit comments

Comments
 (0)