-
Notifications
You must be signed in to change notification settings - Fork 11
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
Support for Custom Data Types in Buffers and Kernel Parameters #27
Comments
You could try something like this:
Note that rust-gpu doesn't currently support casting between pointer types, which would allow implementing Currently buffers on the host and device require I would potentially like to support arrays and or vectors. Unfortunately the only vector library that supports spirv arch is glam, which isn't generic. Custom types would add significant flexibility, but it's harder to ensure soundness. This is because krnlc uses a different toolchain, and a different set of dependencies, and potentially different versions, and isn't re-run when the host crate is compiled, potentially downstream. Stable rust types, and half, have a fixed definition, that cannot or is assumed not to change. Custom types, whether in a dependency or the current crate, might change, and can't be trusted. It might be possible by requiring an unsafe trait, plus validate layouts and such, but it requires significant design. |
As far as I'm aware it is not possible to use custom structs in buffers or as parameters for kernels. This is very limiting. For example, this is not currently possible:
The text was updated successfully, but these errors were encountered: