Re: A perspective on parallelism
- From: anton@xxxxxxxxxxxxxxxxxxxxxxxxxx (Anton Ertl)
- Date: Sun, 04 Oct 2009 08:21:25 GMT
Mayan Moudgill <mayan@xxxxxxxxxxx> writes:
Bernd Paysan wrote:
Well, when the implicit order of GCC patterns hides a bug in the pattern
description, you better have a randomization to uncover that bug early
enough. It will occur sooner or later anyway.
No, its not a bug in the pattern description, its a bug in the user
source code.
Of which user? Do you mean to say that if the code generated by gcc
produces the wrong result for "-(x>y)", then that expression is buggy?
See <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31152>
The bug in the pattern had been there since 1994; it did not show up
gcc-3.3, but it did show up in gcc-4.1, without parallelization. This
demonstrates that such bugs are uncovered sooner or later anyway.
Some forms of pattern based selection _might_ be order invariant.
However, in general they are not. Worse, finding the best set of
selections is generally NP-complete, probably for very simple cases. I
suspect it is enough to allow pattern matching across branches and
permit a small set of overlapping patterns such as:
{A,B} -> Xab
{B,C,D} -> Ybcd
Given that there is no guarantee that we're going to find the best
answer (NP-complete, remember), the instruction selector will generally
use some hueristic, such as greedy.
Using the greedy heuristic, the sequence
M,N,A,B,C,D
will get converted into
M,N,Xab,C,D.
Now, if we were to split the original sequence down the middle and hand
each half to separate threads doing greedy combining,
I think that Bernd meant something different: there are many patterns
that are checked on each sequence. Bernd does not want to split the
sequence, but wants to run the pattern checks in parallel instead of
one after the other.
the result would
be M,N,A from thread 1 and Xbcd from thread 2, combining to give
M,N,A,Xbcd.
Clearly this is better than the sequence found by the sequential
approach, but that is not the relevant point - the point is that it is
different.
So what? In this case it is totally deterministic. You can program a
sequential version that gives the same result. And if your patterns
are correct, this result will be correct.
The problem with this scheme I see is that dividing sequences at
arbitrary places will probably reduce the code quality on average.
- anton
--
M. Anton Ertl Some things have to be seen to be believed
anton@xxxxxxxxxxxxxxxxxxxxxxxxxx Most things have to be believed to be seen
http://www.complang.tuwien.ac.at/anton/home.html
.
- Follow-Ups:
- Re: A perspective on parallelism
- From: Mayan Moudgill
- Re: A perspective on parallelism
- References:
- A perspective on parallelism
- From: Mayan Moudgill
- Re: A perspective on parallelism
- From: Sid Touati
- Re: A perspective on parallelism
- From: nmm1
- Re: A perspective on parallelism
- From: Sid Touati
- Re: A perspective on parallelism
- From: Bernd Paysan
- Re: A perspective on parallelism
- From: Mayan Moudgill
- Re: A perspective on parallelism
- From: Bernd Paysan
- Re: A perspective on parallelism
- From: Mayan Moudgill
- Re: A perspective on parallelism
- From: Bernd Paysan
- Re: A perspective on parallelism
- From: Mayan Moudgill
- A perspective on parallelism
- Prev by Date: Re: A perspective on parallelism
- Next by Date: Re: A perspective on parallelism
- Previous by thread: Re: A perspective on parallelism
- Next by thread: Re: A perspective on parallelism
- Index(es):
Relevant Pages
|
Loading