Skip to content

Commit a6cdcf4

Browse files
authored
Merge pull request #1346 from omarahmed1111/ensure-getinfo-cts-tests-report-same-dependency-creation-object
Add output validation checks for getInfo tests and a small USM spec fix
2 parents 54829f0 + cbd581f commit a6cdcf4

File tree

20 files changed

+217
-30
lines changed

20 files changed

+217
-30
lines changed

include/ur_api.h

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

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

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

@@ -4116,6 +4116,8 @@ urProgramCreateWithIL(
41164116
/// - Following a successful call to this entry point, `phProgram` will
41174117
/// contain a binary of type ::UR_PROGRAM_BINARY_TYPE_COMPILED_OBJECT or
41184118
/// ::UR_PROGRAM_BINARY_TYPE_LIBRARY for `hDevice`.
4119+
/// - The device specified by `hDevice` must be device associated with
4120+
/// context.
41194121
///
41204122
/// @remarks
41214123
/// _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->getDevice(), 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/native_cpu/context.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ urContextGetInfo(ur_context_handle_t hContext, ur_context_info_t propName,
5353
case UR_CONTEXT_INFO_DEVICES:
5454
return returnValue(hContext->_device);
5555
case UR_CONTEXT_INFO_REFERENCE_COUNT:
56-
return returnValue(nullptr);
56+
return returnValue(uint32_t{hContext->getReferenceCount()});
5757
case UR_CONTEXT_INFO_USM_MEMCPY2D_SUPPORT:
5858
return returnValue(true);
5959
case UR_CONTEXT_INFO_USM_FILL2D_SUPPORT:

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_

0 commit comments

Comments
 (0)