Skip to content

Commit b8a0edd

Browse files
authoredMar 18, 2025
Add null runtime check for XNNExecutor::prepare_args (#9265)
### Summary Fixes #9131 In the event that an XNNPACK-delegated model is freed right when inference happens, `XNNExecutor::prepare_args` can crash accessing the runtime. Hence we need to check for null runtime for it, similar to what we are already doing for `XNNExecutor::forward`. ### Test plan Pass all CI/CD.
1 parent 8c32da7 commit b8a0edd

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed
 

‎backends/xnnpack/runtime/XNNExecutor.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,11 @@ ET_NODISCARD Error XNNExecutor::initialize(
7070
* delegate->execute()
7171
*/
7272
ET_NODISCARD Error XNNExecutor::prepare_args(EValue** args) {
73+
ET_CHECK_OR_RETURN_ERROR(
74+
runtime_ != nullptr,
75+
Internal,
76+
"XNNPACK Delegate did not compile correctly");
77+
7378
// Create xnn_externals_value from evalue args
7479
xnn_status status;
7580
for (uint32_t i = 0; i < externals_.size(); ++i) {

0 commit comments

Comments
 (0)