Open bobcao3 opened 2 years ago
I think we can approach this in steps. First step is to support basic argpacks without nesting and resource heaps. Second step is to support resource heap, and the third step would be to support nesting and implicit argument templates
Argument pack is implemented in these Pull Requests.
However, this requirement is not implemented yet.
All parameters of a kernel will be implicitly constructed as an ArgPack; same for return values
Should we mark Argument Pack is completed, ignoring this requirement?
All parameters of a kernel will be implicitly constructed as an ArgPack; same for return values
Or keep this issue open?
Similar to how we currently declare arguments for kernels in Taichi CGraph, we can use something similar for the regular kernel launch (with some additions). This API can be used to simplify kernel arguments and passing of resource for larger production projects, such as a raytracer or a production level PBD simulator.
The idea is that the user can create "argument templates", and "argument packs" that instantiates a template (or construct one implicitly by its content). When launching kernels, the argument templates can be used as the argument type, and the kernel should be able to access its members using subscript or
.member
In addition, we should support cascading argument packs just like structs in C, and we should let the ordinary kernel arguments syntax be an implicit argument pack. This way we get a consistent semantics for all arguments.
Here is an example: