rust-gpu icon indicating copy to clipboard operation
rust-gpu copied to clipboard

Add `ScalarOrVector<S>` trait

Open BeastLe9enD opened this issue 2 years ago • 3 comments

This PR adds the ScalarOrVector<S> trait which represents types that can be either a scalar or a vector!

Motivation: I am currently adding support for subgroup operations, and for example OpGroupNonUniformIAdds result type must be scalar or vector of integer type, so it would be useful to have this trait.

BeastLe9enD avatar Apr 07 '23 02:04 BeastLe9enD

I like the general idea but if rust-gpu doesn't use it internally I'm not really seeing why it should add these things, rather than putting them in a separate crate for people to use?

oisyn avatar Apr 12 '23 12:04 oisyn

@oisyn Yea the thing is, my plan is to add support for subgroup operations after this PR has been merged, and there are some ops like OpGroupNonUniformIAdds for which this trait can be really useful.

BeastLe9enD avatar Apr 14 '23 16:04 BeastLe9enD

Right! I would suggest adding this trait as part of that work.

oisyn avatar Apr 17 '23 11:04 oisyn