firedrakeproject / tsfc

Two-stage form compiler
Other
15 stars 25 forks source link

Propagate argument information for kernel #257

Closed connorjward closed 2 years ago

connorjward commented 3 years ago

The key thing I am trying to accomplish here is to add an arguments attribute to the TSFC kernel that Firedrake can query to determine codegen-type information to pass through to PyOP2 (dim and arity mainly).

I have added a KernelArg class hierarchy to encapsulate this information because it allows us to do some nice stuff with functools.singledispatch in Firedrake. We can straightforwardly convert between TSFC argument types and PyOP2 argument types in a way where the argument ordering does not matter (!) (e.g. here).

This PR goes with https://github.com/OP2/PyOP2/pull/624 and https://github.com/firedrakeproject/firedrake/pull/2172.

Any comments would be appreciated. Crucially, am I on the right track here?