Tensor Comprehensions in SaC

S.-B. Scholz and Artjoms Šinkarovs, “Tensor comprehensions in SaC,” in Proceedings of the 31st symposium on implementation and application of functional languages, Sep. 2019. doi: 10.1145/3412932.3412947.

[URL] [BibTeX]

Abstract

We propose a new notation for data parallel operators on multi-dimensional arrays named tensor comprehensions. This notation combines the basic principle of array-comprehensions with syntactical shortcuts very close to those found in the so-called Tensor Notations used in Physics and Mathematics. As a result, complex operators with rich semantics can be defined concisely. The key to this conciseness lies in the ability to define shape-polymorphic operations combined with the ability to infer array shapes from the immediate context. The paper provides a definition of the proposed notation, a formal shape inference process, as well as a set of re-write rules that translates tensor comprehensions as a zero-cost syntactic sugar into standard SaC expressions.