Pattern matching is a powerful tool for symbolic computations. Applications include symbolic integration, term rewriting systems, theorem proving and the manipulation of abstract syntax trees. Given a pattern and an expression, the goal of pattern matching is to find a substitution for all the variables in the pattern such that the pattern becomes the expression. As an example, consider the pattern f(x), where x is a variable, and the expression f(a). Then the substitution that replaces x with a is a match. In practice, functions can also be associative and/or commutative, which makes matching more complicated and can lead to multiple possible matches.
Utilizing memory and register bandwidth in modern architectures may require swizzles-non-trivial mappings of data and computations onto hardware resources-such as shuffles. We develop Swizzle Inventor to help programmers implement swizzle programs, by writing program sketches that omit swizzles and delegating their creation to an automatic synthesizer. Our synthesis algorithm scales to real-world programs, allowing us to invent new GPU kernels for stencil computations, matrix transposition, and a finite field multiplication algorithm (used in cryptographic applications). The synthesized 2D convolution and finite field multiplication kernels are on average 1.5-3.2x and 1.1-1.7x faster, respectively, than expert-optimized CUDA kernels. CCS Concepts • Software and its engineering → Source code generation; Automatic programming; • Computer systems organization → Single instruction, multiple data.
Pattern matching is a powerful tool for symbolic computations, based on the well-defined theory of term rewriting systems. Application domains include algebraic expressions, abstract syntax trees, and XML and JSON data. Unfortunately, no lightweight implementation of pattern matching as general and flexible as Mathematica exists for Python [Pö16], [Hao14], [Sch14], [Jen15]. Therefore, we created the open source module MatchPy which offers similar pattern matching functionality in Python using a novel algorithm which finds matches for large pattern sets more efficiently by exploiting similarities between patterns.
scite is a Brooklyn-based organization that helps researchers better discover and understand research articles through Smart Citations–citations that display the context of the citation and describe whether the article provides supporting or contrasting evidence. scite is used by students and researchers from around the world and is funded in part by the National Science Foundation and the National Institute on Drug Abuse of the National Institutes of Health.