[macstl-dev] Opinions wanted: tied expressions (multi-valued
expressions and manual loop fusion)
Glen Low
glen.low at pixelglow.com
Mon Nov 28 08:14:29 WST 2005
Dear All:
macstl already fuses loops with single expressions i.e.
e = (a + b) * d;
where each of a, b, d and e are valarrays or refarrays; macstl
automatically expands that out into the right loop with the temp a +
b often just being a register.
Now the next step is to use C++ tuples (or a derivative we optimize
for valarray operations) to fuse multiple expressions in PERL/PHP-
style e.g.
tie (e, f) = tie ((a + b) * d, g - h);
Here the loop encompasses setting e and f element-by-element, and
not: all of e and then all of f.
Things I have to thrash out with the proposal:
1. Should tie only work at the top level or should we allow ties at
the subexpression level? If so, what impact on performance? e.g.
tie (e, f) = tie (a * b) + tie (g * h);
2. How should we spec it so that we don't invalidate multiproc work?
(one of the other projects that might be sponsored, to get macstl to
scale for multiprocs transparently.) We should say something like:
logical parallel sections of the expressions may be evaluated in any
order (since they might be in a multiproc situation).
3. What about dependent expressions e.g.
tie (e, f) = tie ((a + b) * d, e * h); // f now depends on e
4. Further to point 3, should we introduce a special "temp"
placeholder which would work akin to a manual CSE? If so what impact
on 2? How to implement in C++?
5. Do we do automatic or manual tie flattening e.g.
should tie (tie (a, b, c), d, e, f) become tie (a, b, c, d, e, f)
automatically or some other function do this?
6. How to incorporate multiple output syntax into the proposal. E.g.
a deinterleave function that deinterleaves 1 stream into 4 might
logically produce a 4-tuple so that
tie (a, b, c, d) = deinterleave (e);
But then what should the syntax be for applying operations between
the deinterleaved streams i.e. what would be the succinct expression of
tie (a, b, c, d) = deinterelave (e);
f = (a * b) + (c * d);
I suppose if we allowed temp placeholders and tie flattening, then
tie (a, b, c, d, f) = tie (deinterleave (e), (a * b) + (c *d));
could be one such syntax.
Cheers, Glen Low
---
pixelglow software | simply brilliant stuff
www.pixelglow.com
aim: pixglen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.pixelglow.com/lists/archive/macstl-dev/attachments/20051128/7e81ddd7/attachment.html
More information about the macstl-dev
mailing list