Joel Falcou | 30 Sep 22:16
Gravatar

[Proto] Evaluating non-trivial expression

Let's say I have grammar etc.. for writing algebra code like :
a = b+c, u = x + y, z = 3*e;
and have each sub expression containing a = call to be evaluated on a 
different processor.

Where can I put the evaluation call using the context ? In the 
destructor of my associated expression ?
Eric Niebler | 30 Sep 22:59

Re: [Proto] Evaluating non-trivial expression


Joel Falcou wrote:
> Let's say I have grammar etc.. for writing algebra code like :
> a = b+c, u = x + y, z = 3*e;
> and have each sub expression containing a = call to be evaluated on a 
> different processor.
> 
> Where can I put the evaluation call using the context ? In the 
> destructor of my associated expression ?

Interesting. You might try disabling Proto's comma operator and writing 
your own that fires off expression evaluations.

--

-- 
Eric Niebler
BoostPro Computing
http://www.boostpro.com
Joel Falcou | 30 Sep 23:04
Gravatar

Re: [Proto] Evaluating non-trivial expression

Eric Niebler a écrit :
> Interesting. You might try disabling Proto's comma operator and 
> writing your own that fires off expression evaluations.
>
I thought of that but I need the whole AST for checking for various 
stuff. Basically I transform
a algebra AST into a a pair of objects : a tuples of matrix begin() 
pointer and a stripped AST so I
can generate a software pipelined evaluation loop nest.

I tried adding the destructor-based evaluation and it seems to work but 
I fear there
may be some side-effects I'll regret later.
Eric Niebler | 30 Sep 23:15

Re: [Proto] Evaluating non-trivial expression

Joel Falcou wrote:
> Eric Niebler a écrit :
>> Interesting. You might try disabling Proto's comma operator and 
>> writing your own that fires off expression evaluations.
>> 
> I thought of that but I need the whole AST for checking for various 
> stuff. Basically I transform a algebra AST into a a pair of objects :
> a tuples of matrix begin() pointer and a stripped AST so I can
> generate a software pipelined evaluation loop nest.
> 
> I tried adding the destructor-based evaluation and it seems to work
> but I fear there may be some side-effects I'll regret later.

Aside from the usual advice against doing stuff in destructors that can 
fail ... how do you ensure that only the top-level (outermost) object's 
destructor causes an evaluation?

Might it be cleaner to be more explicit about evaluation, e.g., like:

   eval(( a = b+c, u = x + y, z = 3*e ));

?

--

-- 
Eric Niebler
BoostPro Computing
http://www.boostpro.com
Joel Falcou | 30 Sep 23:20
Gravatar

Re: [Proto] Evaluating non-trivial expression

Eric Niebler a écrit :
> Aside from the usual advice against doing stuff in destructors that 
> can fail ... how do you ensure that only the top-level (outermost) 
> object's destructor causes an evaluation?
>
I actually have a flag in the expression that is set when the expression 
is used as a rhs in operator=.
Side effect of doing this is that I can optimize a =b =c+d into a single 
nest loop instead of one nest loop + memcpying the data.
In which cases a destructor can fail ?
> Might it be cleaner to be more explicit about evaluation, e.g., like:
>
>   eval(( a = b+c, u = x + y, z = 3*e ));
It may but it'll break existing code and looks far less intuitive.

___________________________________________
Joel Falcou - Assistant Professor
PARALL Team - LRI - Universite Paris Sud XI
Tel : (+33)1 69 15 66 35

Gmane