Hi Arvind,
Thank you for your help! I tried your example and got expected result.
Playing with OptiML simple test cases, I had some more questions about fusion in Delite. Namely, consider the following example
val buf = SomeDenseVector
val v1 = (0::buf.length) {i:Rep[Int] => buf(i) }
val v2 = (0::buf.length) {i: Rep[Int] => buf(i) + 1}
// buf (2) = 0 // commented yet
val vc1 = v1.map( /* some sunc*/ )
val vc2 = v2.map( /* some func */)
val vc3 = (vc1 + vc2).reduce( (a,b) => a+b)
This example runs fine and produces fully-fused kernel for all operations.
Now let's uncomment buf(2) = 0. The programm runs succesfully but we see such a message at compile-time:
error: write to non-mutable Sym(...)
Observing result, we still see all computations fused into one kernel (which is not correct in general). It looks like despite the fact Delite considered fusion to be impossible, it still performed it and, as a result, the program produced incorrect output. At the same time, output produced by interpreted (not staged) version of program is correct.
So, my questions are: Does Delite always fuse computations (even in case when it is inapplicable)? Is it user who is responsible for program correctness in this case? Is there any way to force Delite not to perform fusion in this case? Is it OK that interpreted and staged version produces different outputs in this case?
Thank you in advance!
best regards,
Alexander.
вторник, 21 января 2014 г., 7:55:39 UTC+4 пользователь asujeeth написал: