Conversation
f4f77a8 to
e6ca8c5
Compare
LegNeato
left a comment
There was a problem hiding this comment.
Wait, we have cargo-gpu, spirvbuilder, and cargo-gpu-install?!?! That seems really bad and confusing.
Can't we just put this behind an off-by-default flag (looks like it is on?) that is turned on for the binary? That way people using cargo-gpu in teh build script don't get changes in behavior and we still get this feature.
So I guess I don't see why cargo-gpu-install even exists?
No we can't, cause if you So our only option was to split the crate in two, a library crate for build scripts ( For additional background:
|
|
Ahhh, I see. Thanks for explaining. |
| /// at least one parameter and instead prints help. | ||
| #[derive(Default, Debug, Clone, Args)] | ||
| #[command(arg_required_else_help(false))] | ||
| pub struct Generate { |
There was a problem hiding this comment.
We should support --lib and --bin like cargo, right now it assumes a certain opinionated shape. How do we specify shader types to include or not include? I glanced over the template and it seems to assume graphics. Should we default to compute (less boilerplate / host code needed) and be able to specify which shader stages to generate? Should we even have a default?
There was a problem hiding this comment.
Adding a compute example should be quite straight forward to do, preferably I'll make that before rustweek.
The bigger problem is that these templates are not single crates, but an entire workspace with a shader crate, a binary crate with a build script and all the setup that's required to get rust-gpu up and running (with cargo-gpu or directly via spirv-builder). So the --lib vs --bin question doesn't really make sense in that context.
I could see a need for a cargo cmd that adds a shader crate to an existing workspace, but that wouldn't just be simple template expansion. It would be scripts that actively modify the workspace to add a shader crate (which could be a template) and the build script so some other crate with all required dependencies. I could see an argument that this should be cargo gpu new and we should move the whole-workspace template expansion to a different subcommand? Or keep this PR as cargo gpu new and later on offer a completely custom template selection, so that graphics becomes the graphics-workspace and adding a shader crate to an existing workspace is graphics-crate? I don't think we'll make that anytime soon, but still think having a discussion about subcommand naming now is a good idea.
There was a problem hiding this comment.
You could have multiple types of libs...a lib that runs on the gpu for others to use (you can scaffold tests using host code), a lib that is host+device that others can call into (for example, you could have a sort() on the host that does the work on the GPU), etc.
So I guess we could punt and put the current one behind --bin, as it is conceptually maps to cargo's --bin if you squint.
But I also agree, maybe we punt and we rename it cargo gpu example or something?
When shadowing cargo want to tie it conceptually as close as possible to cargo's behavior so it just works and is intuitive for people coming from CPU. It also informs us the shape for future upstreaming. So if we can't get there or don't have time to do design work, perhaps it is better to just make it different so there isn't an impedance mismatch.
e6ca8c5 to
ca3e4ed
Compare
cargo-gpu neweffectively aliasescargo generatewith the rust-gpu-template repocargo-gpudepend oncargo-generate, which significantly increases the amount of dependenciescargo-gpuhas. I expect most users to migrate tocargo-gpu-installfor their build script needs.cargo-gpuas a dep, I've madecargo-generatea default feature you can disablecargo generatealso depends on quite a few outdated packages, including vulnerabilities, making ourcargo denycomplain. I've made it pass by ignoring them all, as I don't think there's a huge concern for a dev cmdline tool.close #576