Skip to content

Commit af090b5

Browse files
author
Austin Mason
committed
set async_recursion to ?Send for wasm32 arch
In the dependency upgrade for wgpu from 16 -> 19, wbgpu started properly labeling their structs as non send/sync which broke the expectations for the async_recursion proc macro. By configuring the macro to not expect a type that is Send, the wasm build of wgpu should properly compile. No callsites of the updaded function require that the type be Send, so there wasn't a need to update anything else.
1 parent 7880ed8 commit af090b5

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

wonnx/src/optimizer.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,8 @@ impl<'model> Optimizer<'model> {
292292
}
293293

294294
/// Optimize a branch of a graph (memoized)
295-
#[async_recursion]
295+
#[cfg_attr(target_arch = "wasm32", async_recursion(?Send))]
296+
#[cfg_attr(not(target_arch = "wasm32"), async_recursion)]
296297
pub async fn optimize(
297298
&mut self,
298299
node: Arc<Node<'model>>,
@@ -310,7 +311,8 @@ impl<'model> Optimizer<'model> {
310311

311312
/// Optimize a branch of a graph. Takes a node an attempts to form a chain of nodes with single (dynamic) inputs by
312313
/// traversing towards the inputs.
313-
#[async_recursion]
314+
#[cfg_attr(target_arch = "wasm32", async_recursion(?Send))]
315+
#[cfg_attr(not(target_arch = "wasm32"), async_recursion)]
314316
async fn optimize_actual(
315317
&mut self,
316318
node: Arc<Node<'model>>,

0 commit comments

Comments
 (0)