daphne-eu / daphne

DAPHNE: An Open and Extensible System Infrastructure for Integrated Data Analysis Pipelines
Apache License 2.0
65 stars 57 forks source link

N-ary operations in DaphneDSL (and DaphneLib) #207

Open daphne-eu opened 2 years ago

daphne-eu commented 2 years ago

In GitLab by @pdamme on Mar 8, 2022, 17:28

Many binary built-in functions in DaphneDSL could naturally be extended to n-ary functions. For instance, cbind concatenates two data object vertically. Instead of cbind(cbind(x, y), z), it would be more intuitive to write cbind(x, y, z). Other examples include: elementwise min/max, rbind, intersect/merge/except, and cartesian.

DaphneDSL (and optionally also DaphneLib, the Python API) should support that. It could be achieved in several ways, e.g.

  1. by creating a tree of binary operations in the DaphneDSL parser, or
  2. by allowing n-ary operations in DaphneIR, which are lowered to a tree of binary operations in a new compiler pass, or
  3. by allowing n-ary operations in DaphneIR and providing n-ary kernels for the runtime

Note that operator symbols like + can already be used in an intuitive way (e.g., a + b + c). The DaphneDSL parser creates a tree of binary operations out of them. If approach 3. from above is chose, those binary trees could even be rewritten to n-ary operations.

pdamme commented 6 months ago

Search for (see #207) in the entire code base for some points where this would be helpful. These should be adapted once this feature exists.