Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to get hold of ComputeClient when using existing wgpu setup #355

Open
torsteingrindvik opened this issue Dec 6, 2024 · 1 comment

Comments

@torsteingrindvik
Copy link
Contributor

The wgpu device sharing example shows a possible way to integrate a wgpu device with other programs.

However if R::client(&shared_device) is called there is a panic:

        unreachable!("Cannot select an adapter for an existing device.")

(from crates/cubecl-wgpu/src/runtime.rs request_adapter)

As such there isn't a nice way (or any way?) to get a compute client.

Locally I modified crates/cubecl-wgpu/src/runtime.rs in init_device to return the compute client it creates, but a proper fix would be nice.

@wingertge
Copy link
Contributor

wingertge commented Feb 8, 2025

This should be relatively simple, but one thing to note is that SPIR-V relies on setting some features that aren't set by wgpu (like the Vulkan memory model), so the device still needs to be created on the cubecl side if you want to support SPIR-V. Or if both things need custom features I suppose you could copy paste what we do in SPIR-V and add whatever you need. Either way the device needs custom creation logic, a default wgpu device from another library wouldn't work.

I think we should document that somewhere for the existing device variant, maybe even check for the required features and error if they're not present (so you don't get an ugly segfault later).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants