Open mfranzs opened 8 months ago
FYI this proj demos Rayon+Burn running in the main thread. I know this because the entire screen freezes when I run training. Despite being on the main thread, it still (empirically) requires +atomics,+bulk-memory
. I guess a natural question is "are you sure you can't enable coop/coep?"
(I'm currently trying to figure out how to move it off the main thread, but I'm running into bundler issues. Bah.)
AFAICT that should (both @AlexErrant) work by simply dropping wasm-bindgen-rayon. Rayon readme:
By default, when building to WebAssembly, Rayon will treat it as any other platform without multithreading support and will fall back to sequential iteration. This allows existing code to compile and run successfully with no changes necessary, but it will run slower as it will only use a single CPU core.
To work around
crossOriginIsolation
issues coming from theSharedArrayBuffer
, I'm trying to run this package in the main thread. I see that support was added for this recently.However, when I remove the
rustflags = '--cfg web_sys_unstable_apis -Ctarget-feature=+atomics,+bulk-memory,+mutable-globals'
CLI setting suggested in the README, I get this error:compile_error!("Did you forget to enable
atomics
andbulk-memory
features as outlined in wasm-bindgen-rayon README?");Do you know how I can get this running in the main thread, or how I can get rayon itself running in the main thread? For context, my goal is to run
burn
either in the main thread or in a worker, withcrossOriginIsolation
off.Thank you very much!