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; [email protected]
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 <[email protected]>; Wang, Rander 
> <[email protected]>; Pan, Xiuli <[email protected]>; 
> [email protected]
> 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-----

_______________________________________________
Beignet mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/beignet

Reply via email to