Generative programming research project

Ola Fosheim Grøstad ola.fosheim.grostad+dlang at gmail.com
Fri Dec 1 22:15:17 UTC 2017


On Friday, 1 December 2017 at 20:26:41 UTC, H. S. Teoh wrote:
> But suppose there is a way to tell the compiler certain 
> invariants, i.e., mathematical identities, that matrix 
> expressions satisfy.  You could express, for example, the fact 
> that matrix multiplication is associative and commutative, or 
> that certain expressions always have a constant (or 
> easily-computed) result.  Then you let the optimizer decide 
> which of these identities to use when optimizing a matrix 
> expression, based on its detailed knowledge of the target 
> machine architecture. Essentially, you're *educating* the 
> optimizer with domain-specific knowledge, and thereby enabling 
> it to perform optimizations that it may otherwise not be able 
> to figure out on its own.

Well, yes, but matrix optimization is particularly tricky since 
it depends on so many factors that are hard to deal with for a 
regular programming language. Is the matrix symmetric, Hermitian, 
persymmetric, centrosymmetric, Toeplitz, Hankel, triangular…

> If this can be pulled off, it would allow us to have both 
> domain-specific optimizations *and* a general-purpose 
> programming framework.

One certainly need som better way to extend the type system with 
domain specific high level optimizations and then something that 
translates it all the way down. Currently high level 
optimizations seems to be mostly off the table... I'm sure matlab 
does some of those, but not sure how extensive it is.




More information about the Digitalmars-d mailing list