Skip to content

Commit 081f615

Browse files
committed
Merge branch 'main' into cl-subgroupsizes
2 parents e9e5fe9 + 529e8b9 commit 081f615

40 files changed

+375
-105
lines changed

include/ur_api.h

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4277,6 +4277,11 @@ urProgramCompile(
42774277
/// in `phProgram` will contain a binary of the
42784278
/// ::UR_PROGRAM_BINARY_TYPE_EXECUTABLE type for each device in
42794279
/// `hContext`.
4280+
/// - If a non-success code is returned and `phProgram` is not `nullptr`, it
4281+
/// will contain an unspecified program or `nullptr`. Implementations may
4282+
/// use the build log of this program (accessible via
4283+
/// ::urProgramGetBuildInfo) to provide an error log for the linking
4284+
/// failure.
42804285
///
42814286
/// @remarks
42824287
/// _Analogues_
@@ -6894,7 +6899,6 @@ urEnqueueMemUnmap(
68946899
/// - ::UR_RESULT_ERROR_INVALID_SIZE
68956900
/// + `patternSize == 0 || size == 0`
68966901
/// + `patternSize > size`
6897-
/// + `(patternSize & (patternSize - 1)) != 0`
68986902
/// + `size % patternSize != 0`
68996903
/// + If `size` is higher than the allocation size of `ptr`
69006904
/// - ::UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST
@@ -7665,6 +7669,7 @@ urBindlessImagesImageFreeExp(
76657669
/// + `pImageDesc && UR_MEM_TYPE_IMAGE1D_ARRAY < pImageDesc->type`
76667670
/// - ::UR_RESULT_ERROR_INVALID_IMAGE_SIZE
76677671
/// - ::UR_RESULT_ERROR_INVALID_OPERATION
7672+
/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC
76687673
UR_APIEXPORT ur_result_t UR_APICALL
76697674
urBindlessImagesUnsampledImageCreateExp(
76707675
ur_context_handle_t hContext, ///< [in] handle of the context object
@@ -7703,6 +7708,7 @@ urBindlessImagesUnsampledImageCreateExp(
77037708
/// - ::UR_RESULT_ERROR_INVALID_IMAGE_SIZE
77047709
/// - ::UR_RESULT_ERROR_INVALID_SAMPLER
77057710
/// - ::UR_RESULT_ERROR_INVALID_OPERATION
7711+
/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC
77067712
UR_APIEXPORT ur_result_t UR_APICALL
77077713
urBindlessImagesSampledImageCreateExp(
77087714
ur_context_handle_t hContext, ///< [in] handle of the context object
@@ -8386,7 +8392,6 @@ urCommandBufferAppendUSMMemcpyExp(
83868392
/// - ::UR_RESULT_ERROR_INVALID_SIZE
83878393
/// + `patternSize == 0 || size == 0`
83888394
/// + `patternSize > size`
8389-
/// + `(patternSize & (patternSize - 1)) != 0`
83908395
/// + `size % patternSize != 0`
83918396
/// + If `size` is higher than the allocation size of `ptr`
83928397
/// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT
@@ -9276,6 +9281,11 @@ urProgramCompileExp(
92769281
/// in `phProgram` will contain a binary of the
92779282
/// ::UR_PROGRAM_BINARY_TYPE_EXECUTABLE type for each device in
92789283
/// `phDevices`.
9284+
/// - If a non-success code is returned and `phProgram` is not `nullptr`, it
9285+
/// will contain an unspecified program or `nullptr`. Implementations may
9286+
/// use the build log of this program (accessible via
9287+
/// ::urProgramGetBuildInfo) to provide an error log for the linking
9288+
/// failure.
92799289
///
92809290
/// @remarks
92819291
/// _Analogues_
@@ -9568,7 +9578,6 @@ typedef void (*ur_exp_enqueue_native_command_function_t)(
95689578
/// + `NULL == hQueue`
95699579
/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER
95709580
/// + `NULL == pfnNativeEnqueue`
9571-
/// + `NULL == phEvent`
95729581
/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION
95739582
/// + `NULL != pProperties && ::UR_EXP_ENQUEUE_NATIVE_COMMAND_FLAGS_MASK & pProperties->flags`
95749583
/// - ::UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST
@@ -9588,7 +9597,7 @@ urEnqueueNativeCommandExp(
95889597
const ur_event_handle_t *phEventWaitList, ///< [in][optional][range(0, numEventsInWaitList)] pointer to a list of
95899598
///< events that must be complete before the kernel execution.
95909599
///< If nullptr, the numEventsInWaitList must be 0, indicating no wait events.
9591-
ur_event_handle_t *phEvent ///< [in,out] return an event object that identifies the work that has
9600+
ur_event_handle_t *phEvent ///< [out][optional] return an event object that identifies the work that has
95929601
///< been enqueued in nativeEnqueueFunc.
95939602
);
95949603

scripts/core/EXP-NATIVE-ENQUEUE.rst

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,13 @@ Functions
6565
Changelog
6666
--------------------------------------------------------------------------------
6767

68-
+-----------+------------------------+
69-
| Revision | Changes |
70-
+===========+========================+
71-
| 1.0 | Initial Draft |
72-
+-----------+------------------------+
68+
+-----------+-------------------------+
69+
| Revision | Changes |
70+
+===========+=========================+
71+
| 1.0 | Initial Draft |
72+
+-----------+-------------------------+
73+
| 1.1 | Make `phEvent` optional |
74+
+-----------+-------------------------+
7375

7476

7577
Support
@@ -83,3 +85,4 @@ Contributors
8385
--------------------------------------------------------------------------------
8486

8587
* Hugh Delaney `hugh.delaney@codeplay.com <hugh.delaney@codeplay.com>`_
88+
* Kenneth Benzie (Benie) `k.benzie@codeplay.com <k.benzie@codeplay.com>`_

scripts/core/enqueue.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1061,7 +1061,6 @@ returns:
10611061
- $X_RESULT_ERROR_INVALID_SIZE:
10621062
- "`patternSize == 0 || size == 0`"
10631063
- "`patternSize > size`"
1064-
- "`(patternSize & (patternSize - 1)) != 0`"
10651064
- "`size % patternSize != 0`"
10661065
- "If `size` is higher than the allocation size of `ptr`"
10671066
- $X_RESULT_ERROR_INVALID_EVENT_WAIT_LIST:
@@ -1129,8 +1128,7 @@ class: $xEnqueue
11291128
name: USMPrefetch
11301129
ordinal: "0"
11311130
details:
1132-
- "Prefetching may not be supported for all devices or allocation types. If memory prefetching
1133-
is not supported, the prefetch hint will be ignored."
1131+
- "Prefetching may not be supported for all devices or allocation types. If memory prefetching is not supported, the prefetch hint will be ignored."
11341132
params:
11351133
- type: $x_queue_handle_t
11361134
name: hQueue
@@ -1178,8 +1176,7 @@ class: $xEnqueue
11781176
name: USMAdvise
11791177
ordinal: "0"
11801178
details:
1181-
- "Not all memory advice hints may be supported for all devices or allocation types.
1182-
If a memory advice hint is not supported, it will be ignored."
1179+
- "Not all memory advice hints may be supported for all devices or allocation types. If a memory advice hint is not supported, it will be ignored."
11831180
params:
11841181
- type: $x_queue_handle_t
11851182
name: hQueue

scripts/core/exp-bindless-images.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,7 @@ returns:
469469
- "`pImageDesc && UR_MEM_TYPE_IMAGE1D_ARRAY < pImageDesc->type`"
470470
- $X_RESULT_ERROR_INVALID_IMAGE_SIZE
471471
- $X_RESULT_ERROR_INVALID_OPERATION
472+
- $X_RESULT_ERROR_ADAPTER_SPECIFIC
472473
--- #--------------------------------------------------------------------------
473474
type: function
474475
desc: "Create a bindless sampled image handle"
@@ -507,6 +508,7 @@ returns:
507508
- $X_RESULT_ERROR_INVALID_IMAGE_SIZE
508509
- $X_RESULT_ERROR_INVALID_SAMPLER
509510
- $X_RESULT_ERROR_INVALID_OPERATION
511+
- $X_RESULT_ERROR_ADAPTER_SPECIFIC
510512
--- #--------------------------------------------------------------------------
511513
type: function
512514
desc: "Copy image data Host to Device or Device to Host"

scripts/core/exp-command-buffer.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,6 @@ returns:
408408
- $X_RESULT_ERROR_INVALID_SIZE:
409409
- "`patternSize == 0 || size == 0`"
410410
- "`patternSize > size`"
411-
- "`(patternSize & (patternSize - 1)) != 0`"
412411
- "`size % patternSize != 0`"
413412
- "If `size` is higher than the allocation size of `ptr`"
414413
- $X_RESULT_ERROR_INVALID_MEM_OBJECT

scripts/core/exp-multi-device-compile.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ analogue:
9494
details:
9595
- "The application may call this function from simultaneous threads."
9696
- "Following a successful call to this entry point the program returned in `phProgram` will contain a binary of the $X_PROGRAM_BINARY_TYPE_EXECUTABLE type for each device in `phDevices`."
97+
- "If a non-success code is returned and `phProgram` is not `nullptr`, it will contain an unspecified program or `nullptr`. Implementations may use the build log of this program (accessible via $xProgramGetBuildInfo) to provide an error log for the linking failure."
9798
params:
9899
- type: $x_context_handle_t
99100
name: hContext

scripts/core/exp-native-enqueue.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ params:
111111
- type: $x_event_handle_t*
112112
name: phEvent
113113
desc: |
114-
[in,out] return an event object that identifies the work that has
114+
[out][optional] return an event object that identifies the work that has
115115
been enqueued in nativeEnqueueFunc.
116116
returns:
117117
- $X_RESULT_ERROR_INVALID_NULL_HANDLE

scripts/core/program.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@ analogue:
223223
details:
224224
- "The application may call this function from simultaneous threads."
225225
- "Following a successful call to this entry point the program returned in `phProgram` will contain a binary of the $X_PROGRAM_BINARY_TYPE_EXECUTABLE type for each device in `hContext`."
226+
- "If a non-success code is returned and `phProgram` is not `nullptr`, it will contain an unspecified program or `nullptr`. Implementations may use the build log of this program (accessible via $xProgramGetBuildInfo) to provide an error log for the linking failure."
226227
params:
227228
- type: $x_context_handle_t
228229
name: hContext

scripts/templates/helper.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1248,6 +1248,30 @@ def get_pfntables(specs, meta, namespace, tags):
12481248

12491249
return tables
12501250

1251+
"""
1252+
Public:
1253+
returns an expression setting required output parameters to null on entry
1254+
"""
1255+
def get_initial_null_set(obj):
1256+
cname = obj_traits.class_name(obj)
1257+
lvalue = {
1258+
('$xProgram', 'Link'): 'phProgram',
1259+
('$xProgram', 'LinkExp'): 'phProgram',
1260+
}.get((cname, obj['name']))
1261+
if lvalue is not None:
1262+
return 'if (nullptr != {0}) {{*{0} = nullptr;}}'.format(lvalue)
1263+
return ""
1264+
1265+
"""
1266+
Public:
1267+
returns true if the function always wraps output pointers in loader handles
1268+
"""
1269+
def always_wrap_outputs(obj):
1270+
cname = obj_traits.class_name(obj)
1271+
return (cname, obj['name']) in [
1272+
('$xProgram', 'Link'),
1273+
('$xProgram', 'LinkExp'),
1274+
]
12511275

12521276
"""
12531277
Private:

scripts/templates/ldrddi.cpp.mako

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ namespace ur_loader
4949
{
5050
${x}_result_t result = ${X}_RESULT_SUCCESS;<%
5151
add_local = False
52-
%>
52+
%>${th.get_initial_null_set(obj)}
5353

5454
%if re.match(r"\w+AdapterGet$", th.make_func_name(n, tags, obj)):
5555

@@ -271,7 +271,7 @@ namespace ur_loader
271271
del add_local
272272
%>
273273
%for i, item in enumerate(epilogue):
274-
%if 0 == i and not item['release']:
274+
%if 0 == i and not item['release'] and not th.always_wrap_outputs(obj):
275275
if( ${X}_RESULT_SUCCESS != result )
276276
return result;
277277
@@ -309,7 +309,7 @@ namespace ur_loader
309309
${item['factory']}.getInstance( ${item['name']}[ i ], dditable ) );
310310
%else:
311311
// convert platform handle to loader handle
312-
%if item['optional']:
312+
%if item['optional'] or th.always_wrap_outputs(obj):
313313
if( nullptr != ${item['name']} )
314314
*${item['name']} = reinterpret_cast<${item['type']}>(
315315
${item['factory']}.getInstance( *${item['name']}, dditable ) );

0 commit comments

Comments
 (0)