[Beignet] a question about default optimize option when building

Song, Ruiling ruiling.song at intel.com
Thu Feb 12 00:56:57 PST 2015


It should not read global memory again. We already enable such kind of optimization pass in LLVM.
And (a*b+c*d) should not calculate again. This is common-subexpression. Clang should do it easily. But I am not quite sure whether clang is affected by -O2 or -O0. Anyone know details?

To check specific kernel. You may need to ‘export OCL_OUTPUT_LLVM_AFTER_GEN=1’ and build your program again to get the LLVM IR.

From: Beignet [mailto:beignet-bounces at lists.freedesktop.org] On Behalf Of 彭席汉
Sent: Thursday, February 12, 2015 4:40 PM
To: beignet at lists.freedesktop.org
Subject: [Beignet] a question about default optimize option when building

Hi:

My CL kernel program looks like as follow:

__global unsigned char *p;
int a, b, c, d;

res1 = *p * (a*b + c*d);

<some code here>

res2 = *p * (a*b + c*d + 1);


If I use default build option, for res2, what will EU do? read global memory for pointer p again and do computing of "a*b + c*d" again?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/beignet/attachments/20150212/86716198/attachment-0001.html>


More information about the Beignet mailing list