[Beignet] [PATCH] do constant folding for kernel struct args

Yang, Rong R rong.r.yang at intel.com
Fri Jun 16 05:44:28 UTC 2017


Ok, It only handle very special case, and must all before postPhiCopyOptimization.
I will pushed it, thanks.

> -----Original Message-----
> From: Guo, Yejun
> Sent: Tuesday, June 13, 2017 20:51
> To: Yang, Rong R <rong.r.yang at intel.com>; Wang, Rander
> <rander.wang at intel.com>; Pan, Xiuli <xiuli.pan at intel.com>;
> beignet at lists.freedesktop.org
> Subject: RE: [Beignet] [PATCH] do constant folding for kernel struct args
> 
> In current implementation, only loadi and add are considered.
> 
> In the example, since %22 is dst of MOV, it will not be recorded. It is recorded
> and so impacts the IR only if %22 is dst of ADD.
> 
> -----Original Message-----
> From: Yang, Rong R
> Sent: Tuesday, June 13, 2017 4:59 PM
> To: Guo, Yejun; Wang, Rander; Pan, Xiuli; beignet at lists.freedesktop.org
> Subject: RE: [Beignet] [PATCH] do constant folding for kernel struct args
> 
> foldFunctionStructArgConstOffset is called before the
> lowerFunctionArguments.
> If foldFunctionStructArgConstOffset is wrong, the INDIRECT_MOV generated
> in lowerFunctionArguments also wrong.
> 
> I afraid the following ir:
> 
> BB2:
> LOADI %30, 4
> Add %20, %10, %30    //%10 is a struct argument
> MOV %22, %20   //phi-mov
> 
> BB3:
> LOADI %31, 8
> Add %21, %11, %31    //%11 is another struct argument
> MOV %22, %21   //phi-mov
> 
> BB4:
> LOADI %32, 4
> Add %33, %22, %32
> 
> Will be converted to:
> LOADI %42, 8
> Add %33, %10, %42
> 
> If so, the lowerFunctionArguments will wrong.
> 
> > -----Original Message-----
> > From: Guo, Yejun
> > Sent: Tuesday, June 13, 2017 16:39
> > To: Yang, Rong R <rong.r.yang at intel.com>; Wang, Rander
> > <rander.wang at intel.com>; Pan, Xiuli <xiuli.pan at intel.com>;
> > beignet at lists.freedesktop.org
> > Subject: RE: [Beignet] [PATCH] do constant folding for kernel struct
> > args
> >
> > I just tried such kernel, and the generated GEN IR is INDIRECT_MOV, it
> > has nothing to do with this patch.
> >
> > Thanks
> > Yejun
> >
> > -----Original Message-----



More information about the Beignet mailing list