Skip to content

Commit cbd581f

Browse files
omarahmed1111kbenzie
authored andcommitted
Add clarification about size to usm spec and program associated device
1 parent 83a04c6 commit cbd581f

File tree

10 files changed

+32
-25
lines changed

10 files changed

+32
-25
lines changed

include/ur_api.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3449,7 +3449,7 @@ urUSMHostAlloc(
34493449
ur_context_handle_t hContext, ///< [in] handle of the context object
34503450
const ur_usm_desc_t *pUSMDesc, ///< [in][optional] USM memory allocation descriptor
34513451
ur_usm_pool_handle_t pool, ///< [in][optional] Pointer to a pool created using urUSMPoolCreate
3452-
size_t size, ///< [in] size in bytes of the USM memory object to be allocated
3452+
size_t size, ///< [in] minimum size in bytes of the USM memory object to be allocated
34533453
void **ppMem ///< [out] pointer to USM host memory object
34543454
);
34553455

@@ -3497,7 +3497,7 @@ urUSMDeviceAlloc(
34973497
ur_device_handle_t hDevice, ///< [in] handle of the device object
34983498
const ur_usm_desc_t *pUSMDesc, ///< [in][optional] USM memory allocation descriptor
34993499
ur_usm_pool_handle_t pool, ///< [in][optional] Pointer to a pool created using urUSMPoolCreate
3500-
size_t size, ///< [in] size in bytes of the USM memory object to be allocated
3500+
size_t size, ///< [in] minimum size in bytes of the USM memory object to be allocated
35013501
void **ppMem ///< [out] pointer to USM device memory object
35023502
);
35033503

@@ -3546,7 +3546,7 @@ urUSMSharedAlloc(
35463546
ur_device_handle_t hDevice, ///< [in] handle of the device object
35473547
const ur_usm_desc_t *pUSMDesc, ///< [in][optional] Pointer to USM memory allocation descriptor.
35483548
ur_usm_pool_handle_t pool, ///< [in][optional] Pointer to a pool created using urUSMPoolCreate
3549-
size_t size, ///< [in] size in bytes of the USM memory object to be allocated
3549+
size_t size, ///< [in] minimum size in bytes of the USM memory object to be allocated
35503550
void **ppMem ///< [out] pointer to USM shared memory object
35513551
);
35523552

@@ -4117,6 +4117,8 @@ urProgramCreateWithIL(
41174117
/// - Following a successful call to this entry point, `phProgram` will
41184118
/// contain a binary of type ::UR_PROGRAM_BINARY_TYPE_COMPILED_OBJECT or
41194119
/// ::UR_PROGRAM_BINARY_TYPE_LIBRARY for `hDevice`.
4120+
/// - The device specified by `hDevice` must be device associated with
4121+
/// context.
41204122
///
41214123
/// @remarks
41224124
/// _Analogues_

scripts/core/program.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ analogue:
128128
details:
129129
- "The application may call this function from simultaneous threads."
130130
- "Following a successful call to this entry point, `phProgram` will contain a binary of type $X_PROGRAM_BINARY_TYPE_COMPILED_OBJECT or $X_PROGRAM_BINARY_TYPE_LIBRARY for `hDevice`."
131+
- "The device specified by `hDevice` must be device associated with context."
131132
params:
132133
- type: $x_context_handle_t
133134
name: hContext

scripts/core/usm.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ params:
248248
desc: "[in][optional] Pointer to a pool created using urUSMPoolCreate"
249249
- type: "size_t"
250250
name: size
251-
desc: "[in] size in bytes of the USM memory object to be allocated"
251+
desc: "[in] minimum size in bytes of the USM memory object to be allocated"
252252
- type: void**
253253
name: ppMem
254254
desc: "[out] pointer to USM host memory object"
@@ -293,7 +293,7 @@ params:
293293
desc: "[in][optional] Pointer to a pool created using urUSMPoolCreate"
294294
- type: "size_t"
295295
name: size
296-
desc: "[in] size in bytes of the USM memory object to be allocated"
296+
desc: "[in] minimum size in bytes of the USM memory object to be allocated"
297297
- type: void**
298298
name: ppMem
299299
desc: "[out] pointer to USM device memory object"
@@ -339,7 +339,7 @@ params:
339339
desc: "[in][optional] Pointer to a pool created using urUSMPoolCreate"
340340
- type: "size_t"
341341
name: size
342-
desc: "[in] size in bytes of the USM memory object to be allocated"
342+
desc: "[in] minimum size in bytes of the USM memory object to be allocated"
343343
- type: void**
344344
name: ppMem
345345
desc: "[out] pointer to USM shared memory object"

source/adapters/hip/program.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ urProgramGetInfo(ur_program_handle_t hProgram, ur_program_info_t propName,
368368
case UR_PROGRAM_INFO_NUM_DEVICES:
369369
return ReturnValue(1u);
370370
case UR_PROGRAM_INFO_DEVICES:
371-
return ReturnValue(hProgram->getContext()->getDevices()[0], 1);
371+
return ReturnValue(&hProgram->getContext()->getDevices()[0], 1);
372372
case UR_PROGRAM_INFO_SOURCE:
373373
return ReturnValue(hProgram->Binary);
374374
case UR_PROGRAM_INFO_BINARY_SIZES:

source/adapters/null/ur_nullddi.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1268,7 +1268,7 @@ __urdlllocal ur_result_t UR_APICALL urUSMHostAlloc(
12681268
ur_usm_pool_handle_t
12691269
pool, ///< [in][optional] Pointer to a pool created using urUSMPoolCreate
12701270
size_t
1271-
size, ///< [in] size in bytes of the USM memory object to be allocated
1271+
size, ///< [in] minimum size in bytes of the USM memory object to be allocated
12721272
void **ppMem ///< [out] pointer to USM host memory object
12731273
) try {
12741274
ur_result_t result = UR_RESULT_SUCCESS;
@@ -1296,7 +1296,7 @@ __urdlllocal ur_result_t UR_APICALL urUSMDeviceAlloc(
12961296
ur_usm_pool_handle_t
12971297
pool, ///< [in][optional] Pointer to a pool created using urUSMPoolCreate
12981298
size_t
1299-
size, ///< [in] size in bytes of the USM memory object to be allocated
1299+
size, ///< [in] minimum size in bytes of the USM memory object to be allocated
13001300
void **ppMem ///< [out] pointer to USM device memory object
13011301
) try {
13021302
ur_result_t result = UR_RESULT_SUCCESS;
@@ -1324,7 +1324,7 @@ __urdlllocal ur_result_t UR_APICALL urUSMSharedAlloc(
13241324
ur_usm_pool_handle_t
13251325
pool, ///< [in][optional] Pointer to a pool created using urUSMPoolCreate
13261326
size_t
1327-
size, ///< [in] size in bytes of the USM memory object to be allocated
1327+
size, ///< [in] minimum size in bytes of the USM memory object to be allocated
13281328
void **ppMem ///< [out] pointer to USM shared memory object
13291329
) try {
13301330
ur_result_t result = UR_RESULT_SUCCESS;

source/loader/layers/tracing/ur_trcddi.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1331,7 +1331,7 @@ __urdlllocal ur_result_t UR_APICALL urUSMHostAlloc(
13311331
ur_usm_pool_handle_t
13321332
pool, ///< [in][optional] Pointer to a pool created using urUSMPoolCreate
13331333
size_t
1334-
size, ///< [in] size in bytes of the USM memory object to be allocated
1334+
size, ///< [in] minimum size in bytes of the USM memory object to be allocated
13351335
void **ppMem ///< [out] pointer to USM host memory object
13361336
) {
13371337
auto pfnHostAlloc = context.urDdiTable.USM.pfnHostAlloc;
@@ -1363,7 +1363,7 @@ __urdlllocal ur_result_t UR_APICALL urUSMDeviceAlloc(
13631363
ur_usm_pool_handle_t
13641364
pool, ///< [in][optional] Pointer to a pool created using urUSMPoolCreate
13651365
size_t
1366-
size, ///< [in] size in bytes of the USM memory object to be allocated
1366+
size, ///< [in] minimum size in bytes of the USM memory object to be allocated
13671367
void **ppMem ///< [out] pointer to USM device memory object
13681368
) {
13691369
auto pfnDeviceAlloc = context.urDdiTable.USM.pfnDeviceAlloc;
@@ -1396,7 +1396,7 @@ __urdlllocal ur_result_t UR_APICALL urUSMSharedAlloc(
13961396
ur_usm_pool_handle_t
13971397
pool, ///< [in][optional] Pointer to a pool created using urUSMPoolCreate
13981398
size_t
1399-
size, ///< [in] size in bytes of the USM memory object to be allocated
1399+
size, ///< [in] minimum size in bytes of the USM memory object to be allocated
14001400
void **ppMem ///< [out] pointer to USM shared memory object
14011401
) {
14021402
auto pfnSharedAlloc = context.urDdiTable.USM.pfnSharedAlloc;

source/loader/layers/validation/ur_valddi.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1768,7 +1768,7 @@ __urdlllocal ur_result_t UR_APICALL urUSMHostAlloc(
17681768
ur_usm_pool_handle_t
17691769
pool, ///< [in][optional] Pointer to a pool created using urUSMPoolCreate
17701770
size_t
1771-
size, ///< [in] size in bytes of the USM memory object to be allocated
1771+
size, ///< [in] minimum size in bytes of the USM memory object to be allocated
17721772
void **ppMem ///< [out] pointer to USM host memory object
17731773
) {
17741774
auto pfnHostAlloc = context.urDdiTable.USM.pfnHostAlloc;
@@ -1825,7 +1825,7 @@ __urdlllocal ur_result_t UR_APICALL urUSMDeviceAlloc(
18251825
ur_usm_pool_handle_t
18261826
pool, ///< [in][optional] Pointer to a pool created using urUSMPoolCreate
18271827
size_t
1828-
size, ///< [in] size in bytes of the USM memory object to be allocated
1828+
size, ///< [in] minimum size in bytes of the USM memory object to be allocated
18291829
void **ppMem ///< [out] pointer to USM device memory object
18301830
) {
18311831
auto pfnDeviceAlloc = context.urDdiTable.USM.pfnDeviceAlloc;
@@ -1892,7 +1892,7 @@ __urdlllocal ur_result_t UR_APICALL urUSMSharedAlloc(
18921892
ur_usm_pool_handle_t
18931893
pool, ///< [in][optional] Pointer to a pool created using urUSMPoolCreate
18941894
size_t
1895-
size, ///< [in] size in bytes of the USM memory object to be allocated
1895+
size, ///< [in] minimum size in bytes of the USM memory object to be allocated
18961896
void **ppMem ///< [out] pointer to USM shared memory object
18971897
) {
18981898
auto pfnSharedAlloc = context.urDdiTable.USM.pfnSharedAlloc;

source/loader/ur_ldrddi.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1712,7 +1712,7 @@ __urdlllocal ur_result_t UR_APICALL urUSMHostAlloc(
17121712
ur_usm_pool_handle_t
17131713
pool, ///< [in][optional] Pointer to a pool created using urUSMPoolCreate
17141714
size_t
1715-
size, ///< [in] size in bytes of the USM memory object to be allocated
1715+
size, ///< [in] minimum size in bytes of the USM memory object to be allocated
17161716
void **ppMem ///< [out] pointer to USM host memory object
17171717
) {
17181718
ur_result_t result = UR_RESULT_SUCCESS;
@@ -1747,7 +1747,7 @@ __urdlllocal ur_result_t UR_APICALL urUSMDeviceAlloc(
17471747
ur_usm_pool_handle_t
17481748
pool, ///< [in][optional] Pointer to a pool created using urUSMPoolCreate
17491749
size_t
1750-
size, ///< [in] size in bytes of the USM memory object to be allocated
1750+
size, ///< [in] minimum size in bytes of the USM memory object to be allocated
17511751
void **ppMem ///< [out] pointer to USM device memory object
17521752
) {
17531753
ur_result_t result = UR_RESULT_SUCCESS;
@@ -1785,7 +1785,7 @@ __urdlllocal ur_result_t UR_APICALL urUSMSharedAlloc(
17851785
ur_usm_pool_handle_t
17861786
pool, ///< [in][optional] Pointer to a pool created using urUSMPoolCreate
17871787
size_t
1788-
size, ///< [in] size in bytes of the USM memory object to be allocated
1788+
size, ///< [in] minimum size in bytes of the USM memory object to be allocated
17891789
void **ppMem ///< [out] pointer to USM shared memory object
17901790
) {
17911791
ur_result_t result = UR_RESULT_SUCCESS;

source/loader/ur_libapi.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2204,7 +2204,7 @@ ur_result_t UR_APICALL urUSMHostAlloc(
22042204
ur_usm_pool_handle_t
22052205
pool, ///< [in][optional] Pointer to a pool created using urUSMPoolCreate
22062206
size_t
2207-
size, ///< [in] size in bytes of the USM memory object to be allocated
2207+
size, ///< [in] minimum size in bytes of the USM memory object to be allocated
22082208
void **ppMem ///< [out] pointer to USM host memory object
22092209
) try {
22102210
auto pfnHostAlloc = ur_lib::context->urDdiTable.USM.pfnHostAlloc;
@@ -2263,7 +2263,7 @@ ur_result_t UR_APICALL urUSMDeviceAlloc(
22632263
ur_usm_pool_handle_t
22642264
pool, ///< [in][optional] Pointer to a pool created using urUSMPoolCreate
22652265
size_t
2266-
size, ///< [in] size in bytes of the USM memory object to be allocated
2266+
size, ///< [in] minimum size in bytes of the USM memory object to be allocated
22672267
void **ppMem ///< [out] pointer to USM device memory object
22682268
) try {
22692269
auto pfnDeviceAlloc = ur_lib::context->urDdiTable.USM.pfnDeviceAlloc;
@@ -2323,7 +2323,7 @@ ur_result_t UR_APICALL urUSMSharedAlloc(
23232323
ur_usm_pool_handle_t
23242324
pool, ///< [in][optional] Pointer to a pool created using urUSMPoolCreate
23252325
size_t
2326-
size, ///< [in] size in bytes of the USM memory object to be allocated
2326+
size, ///< [in] minimum size in bytes of the USM memory object to be allocated
23272327
void **ppMem ///< [out] pointer to USM shared memory object
23282328
) try {
23292329
auto pfnSharedAlloc = ur_lib::context->urDdiTable.USM.pfnSharedAlloc;
@@ -2940,6 +2940,8 @@ ur_result_t UR_APICALL urProgramCreateWithIL(
29402940
/// - Following a successful call to this entry point, `phProgram` will
29412941
/// contain a binary of type ::UR_PROGRAM_BINARY_TYPE_COMPILED_OBJECT or
29422942
/// ::UR_PROGRAM_BINARY_TYPE_LIBRARY for `hDevice`.
2943+
/// - The device specified by `hDevice` must be device associated with
2944+
/// context.
29432945
///
29442946
/// @remarks
29452947
/// _Analogues_

source/ur_api.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1892,7 +1892,7 @@ ur_result_t UR_APICALL urUSMHostAlloc(
18921892
ur_usm_pool_handle_t
18931893
pool, ///< [in][optional] Pointer to a pool created using urUSMPoolCreate
18941894
size_t
1895-
size, ///< [in] size in bytes of the USM memory object to be allocated
1895+
size, ///< [in] minimum size in bytes of the USM memory object to be allocated
18961896
void **ppMem ///< [out] pointer to USM host memory object
18971897
) {
18981898
ur_result_t result = UR_RESULT_SUCCESS;
@@ -1945,7 +1945,7 @@ ur_result_t UR_APICALL urUSMDeviceAlloc(
19451945
ur_usm_pool_handle_t
19461946
pool, ///< [in][optional] Pointer to a pool created using urUSMPoolCreate
19471947
size_t
1948-
size, ///< [in] size in bytes of the USM memory object to be allocated
1948+
size, ///< [in] minimum size in bytes of the USM memory object to be allocated
19491949
void **ppMem ///< [out] pointer to USM device memory object
19501950
) {
19511951
ur_result_t result = UR_RESULT_SUCCESS;
@@ -1999,7 +1999,7 @@ ur_result_t UR_APICALL urUSMSharedAlloc(
19991999
ur_usm_pool_handle_t
20002000
pool, ///< [in][optional] Pointer to a pool created using urUSMPoolCreate
20012001
size_t
2002-
size, ///< [in] size in bytes of the USM memory object to be allocated
2002+
size, ///< [in] minimum size in bytes of the USM memory object to be allocated
20032003
void **ppMem ///< [out] pointer to USM shared memory object
20042004
) {
20052005
ur_result_t result = UR_RESULT_SUCCESS;
@@ -2503,6 +2503,8 @@ ur_result_t UR_APICALL urProgramCreateWithIL(
25032503
/// - Following a successful call to this entry point, `phProgram` will
25042504
/// contain a binary of type ::UR_PROGRAM_BINARY_TYPE_COMPILED_OBJECT or
25052505
/// ::UR_PROGRAM_BINARY_TYPE_LIBRARY for `hDevice`.
2506+
/// - The device specified by `hDevice` must be device associated with
2507+
/// context.
25062508
///
25072509
/// @remarks
25082510
/// _Analogues_

0 commit comments

Comments
 (0)