Skip to content

Commit c282ba0

Browse files
authored
Add validation layer support for nullptr events (#929)
This commit adds checks in the validation layer for the case where the event wait list parameter in urEnqueue entrypoints contains a nullptr event.
1 parent cc243f3 commit c282ba0

25 files changed

+380
-0
lines changed

scripts/templates/helper.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1328,3 +1328,14 @@ def get_create_retain_release_functions(specs, namespace, tags):
13281328
)
13291329

13301330
return {"create": create_funcs, "retain": retain_funcs, "release": release_funcs}
1331+
1332+
1333+
def get_event_wait_list_functions(specs, namespace, tags):
1334+
funcs = []
1335+
for s in specs:
1336+
for obj in s['objects']:
1337+
if re.match(r"function", obj['type']):
1338+
if any(x['name'] == 'phEventWaitList' for x in obj['params']) and any(
1339+
x['name'] == 'numEventsInWaitList' for x in obj['params']):
1340+
funcs.append(make_func_name(namespace, tags, obj))
1341+
return funcs

scripts/templates/valddi.cpp.mako

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,16 @@ namespace ur_validation_layer
6060

6161
%endfor
6262
%endfor
63+
%if func_name in th.get_event_wait_list_functions(specs, n, tags):
64+
if (phEventWaitList != NULL && numEventsInWaitList > 0) {
65+
for (uint32_t i = 0; i < numEventsInWaitList; ++i) {
66+
if (phEventWaitList[i] == NULL) {
67+
return UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST;
68+
}
69+
}
70+
}
71+
%endif
72+
6373
}
6474

6575
${x}_result_t result = ${th.make_pfn_name(n, tags, obj)}( ${", ".join(th.make_param_lines(n, tags, obj, format=["name"]))} );

0 commit comments

Comments
 (0)