kokkos / pykokkos

Performance portable parallel programming in Python.
95 stars 19 forks source link

Improve type checking in ufuncs #80

Open NaderAlAwar opened 2 years ago

NaderAlAwar commented 2 years ago

Currently we're checking view datatypes in ufuncs using string comparison (e.g. here). The reasons are explained in Tyler's comment here. This can break quite easily later and is also not desirable for performance reasons.

Additionally, ufuncs with two operands only allow specific combinations of types (e.g. here), when they should be less restrictive in what combinations of types are allowed. As mentioned in Tyler's comment, we want to have a system for type promotion.

tylerjereddy commented 2 years ago

There's a detailed discussion/proposal to standardize the approach to data type inspection in the next version of the array API standard here: https://github.com/data-apis/array-api/issues/425

So, we may want to follow something similar to whatever they decide on there, if feasible.