Skip to content

Commit

Permalink
Fix zetCommandListAppendMetricQueryEnd for phWaitEvent handle transla…
Browse files Browse the repository at this point in the history
…tion

- Fixed zetCommandListAppendMetricQueryEnd to properly translate
  handles.

Signed-off-by: Neil R. Spruit <neil.r.spruit@intel.com>
  • Loading branch information
nrspruit committed Aug 22, 2024
1 parent 3faf300 commit 296db6d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
10 changes: 10 additions & 0 deletions scripts/templates/ldrddi.cpp.mako
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,15 @@ namespace loader
}
}
%endif
%if re.match(r"\w+CommandListAppendMetricQueryEnd$", th.make_func_name(n, tags, obj)):
// convert loader handles to driver handles
auto phWaitEventsLocal = new ze_event_handle_t [numWaitEvents];
for( size_t i = 0; ( nullptr != phWaitEvents ) && ( i < numWaitEvents ); ++i )
phWaitEventsLocal[ i ] = reinterpret_cast<ze_event_object_t*>( phWaitEvents[ i ] )->handle;

// forward to device-driver
result = pfnAppendMetricQueryEnd( hCommandList, hMetricQuery, hSignalEvent, numWaitEvents, phWaitEventsLocal );
%else:
// forward to device-driver
%if add_local:
result = ${th.make_pfn_name(n, tags, obj)}( ${", ".join(th.make_param_lines(n, tags, obj, format=["name", "local"]))} );
Expand All @@ -188,6 +197,7 @@ namespace loader
result = ${th.make_pfn_name(n, tags, obj)}( ${", ".join(th.make_param_lines(n, tags, obj, format=["name"]))} );
%endif
%endif
%endif
<%
del arrays_to_delete
del add_local%>
Expand Down
7 changes: 6 additions & 1 deletion source/loader/zet_ldrddi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1026,8 +1026,13 @@ namespace loader
// convert loader handle to driver handle
hSignalEvent = ( hSignalEvent ) ? reinterpret_cast<ze_event_object_t*>( hSignalEvent )->handle : nullptr;

// convert loader handles to driver handles
auto phWaitEventsLocal = new ze_event_handle_t [numWaitEvents];
for( size_t i = 0; ( nullptr != phWaitEvents ) && ( i < numWaitEvents ); ++i )
phWaitEventsLocal[ i ] = reinterpret_cast<ze_event_object_t*>( phWaitEvents[ i ] )->handle;

// forward to device-driver
result = pfnAppendMetricQueryEnd( hCommandList, hMetricQuery, hSignalEvent, numWaitEvents, phWaitEvents );
result = pfnAppendMetricQueryEnd( hCommandList, hMetricQuery, hSignalEvent, numWaitEvents, phWaitEventsLocal );

return result;
}
Expand Down

0 comments on commit 296db6d

Please sign in to comment.