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

Kernel Fusion TODOs #57

Open
8 tasks
mjguynn opened this issue May 17, 2023 · 0 comments
Open
8 tasks

Kernel Fusion TODOs #57

mjguynn opened this issue May 17, 2023 · 0 comments

Comments

@mjguynn
Copy link
Contributor

mjguynn commented May 17, 2023

  • AllocTemporary elision. If a small temporary allocation is exclusively used within a single fused kernel, that allocation should be skipped, and it should be replaced with a global variable inside the compute shader. Implementing this might be kind of ugly because the binding-to-global remapping happens at fused kernel construction time.
    • should avoid leaving gaps in the binding layout
  • There's some really awful type-punning going on while translating naga::Statement::Emit during kernel fusion. Worse, it's not even guaranteed to be correct -- the process of expression remapping may turn a contiguous range into multiple disjoint ranges if we're not careful. It might be best to just halt kernel fusion if we encounter Emit.
  • Fused kernels aren't added to the FFI interface due to mutability restrictions. This caused the signatures of codegen functions to change; they now take references to GPU shader modules rather than external function IDs. I'm not sure whether this is a good or bad change...
  • Shaders must now have unique names.
  • GpuKernel should store the actual Naga shader datastructure (in a newtyped wrapper, of course). Storing it as a string causes a bunch of redundant serialization/deserialization. The main challenge with this approach is serializing/deserializing from RON, where we want the shader's string contents. I think this can be addressed with custom serialization logic in the newtyped wrapper.
  • It would be nice to have a better way of showing what kernel fusion actually does. Right now, you have to look at the generated Rust code to understand what it does.
  • FuseState::finish is just really ugly. It should probably be rewritten from scratch.
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

1 participant