Skip to content

Commit b9917f8

Browse files
authored
[Tools] Diagnose coarse-fences invocation without HAL device (#24274)
Coarse-fences invocation requires the caller to provide wait/signal fences backed by a HAL device. If module dependency resolution did not create a HAL device, the invoked function is not declaring the HAL dependency needed to signal or fail its completion fence. Fail with a specific diagnostic before trying to create the signal fence instead of falling through to a null-device failure.
1 parent ab5cfdf commit b9917f8

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

runtime/src/iree/tooling/function_util.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,17 @@ iree_status_t iree_tooling_append_async_fences(
2121
IREE_TRACE_ZONE_END(z0);
2222
return iree_ok_status();
2323
}
24+
if (!device) {
25+
IREE_TRACE_ZONE_END(z0);
26+
return iree_make_status(
27+
IREE_STATUS_FAILED_PRECONDITION,
28+
"coarse-fences invocation requires a HAL device to "
29+
"create wait/signal fences, but module dependency "
30+
"resolution did not create one; ensure the invoked "
31+
"function signals or fails its signal fence through "
32+
"HAL operations so the module declares a HAL "
33+
"dependency");
34+
}
2435

2536
// Create the signal fence as a 0->1 transition. The caller will wait on that.
2637
iree_hal_semaphore_t* semaphore = NULL;

0 commit comments

Comments
 (0)