Skip to content

Commit 5412ef0

Browse files
Fixed wasm32 non atomic
1 parent d1173f3 commit 5412ef0

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

crates/cubecl-wgpu/src/compute/server.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ pub struct WgpuServer<C: WgpuCompiler> {
2525
memory_management: MemoryManagement<WgpuStorage>,
2626
pub(crate) device: Pdrc<wgpu::Device>,
2727
queue: Pdrc<wgpu::Queue>,
28+
#[allow(unused)]
2829
pub(crate) adapter: Pdrc<wgpu::Adapter>,
2930
encoder: CommandEncoder,
3031
current_pass: Option<ComputePass<'static>>,

crates/cubecl-wgpu/src/runtime.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ use crate::{
77
compute::{WgpuServer, WgpuStorage},
88
AutoGraphicsApi, GraphicsApi, Pdrc, WgpuDevice,
99
};
10-
use cubecl_core::{channel::ComputeChannel, server::ComputeServer, Feature, Runtime};
10+
#[cfg(not(all(target_arch = "wasm32", target_feature = "atomics")))]
11+
use cubecl_core::future;
12+
#[cfg(all(target_arch = "wasm32", target_feature = "atomics"))]
13+
use cubecl_core::{channel::ComputeChannel, server::ComputeServer};
14+
use cubecl_core::{Feature, Runtime};
1115
#[cfg(not(all(target_arch = "wasm32", target_feature = "atomics")))]
1216
use cubecl_runtime::channel::MutexComputeChannel;
1317
use cubecl_runtime::{
@@ -31,6 +35,7 @@ thread_local! {
3135
static LOCAL_DEVICE: RefCell<hashbrown::HashMap<WgpuDevice, Rc<RefCell<Server>>>> = RefCell::new(hashbrown::HashMap::default());
3236
}
3337

38+
#[cfg(all(target_arch = "wasm32", target_feature = "atomics"))]
3439
static RUNTIME: ComputeRuntime<WgpuDevice, Server, ThreadLocalChannel> = ComputeRuntime::new();
3540

3641
/// The compute instance is shared across all [wgpu runtimes](WgpuRuntime).
@@ -214,6 +219,7 @@ pub(crate) fn create_client_on_setup<C: WgpuCompiler>(
214219
memory_management,
215220
setup.device.clone(),
216221
setup.queue,
222+
setup.adapter.clone(),
217223
options.tasks_max,
218224
);
219225
let channel = MutexComputeChannel::new(server);

0 commit comments

Comments
 (0)