Skip to content

Commit

Permalink
Add validation layer support for nullptr events (#929)
Browse files Browse the repository at this point in the history
This commit adds checks in the validation layer for the case where
the event wait list parameter in urEnqueue entrypoints contains a
nullptr event.
  • Loading branch information
fabiomestre committed Oct 5, 2023
1 parent cc243f3 commit c282ba0
Show file tree
Hide file tree
Showing 25 changed files with 380 additions and 0 deletions.
11 changes: 11 additions & 0 deletions scripts/templates/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -1328,3 +1328,14 @@ def get_create_retain_release_functions(specs, namespace, tags):
)

return {"create": create_funcs, "retain": retain_funcs, "release": release_funcs}


def get_event_wait_list_functions(specs, namespace, tags):
funcs = []
for s in specs:
for obj in s['objects']:
if re.match(r"function", obj['type']):
if any(x['name'] == 'phEventWaitList' for x in obj['params']) and any(
x['name'] == 'numEventsInWaitList' for x in obj['params']):
funcs.append(make_func_name(namespace, tags, obj))
return funcs
10 changes: 10 additions & 0 deletions scripts/templates/valddi.cpp.mako
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,16 @@ namespace ur_validation_layer

%endfor
%endfor
%if func_name in th.get_event_wait_list_functions(specs, n, tags):
if (phEventWaitList != NULL && numEventsInWaitList > 0) {
for (uint32_t i = 0; i < numEventsInWaitList; ++i) {
if (phEventWaitList[i] == NULL) {
return UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST;
}
}
}
%endif

}

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

0 comments on commit c282ba0

Please sign in to comment.