Note a IL compiler bug

2 views
Skip to first unread message

the729 (Wu Tianji)

unread,
Mar 18, 2009, 9:23:58 AM3/18/09
to AMD-SPL
There is a bug about the IL compiler and I have already posted it on
the forum (http://forums.amd.com/devforum/messageview.cfm?
catid=328&threadid=110498&enterthread=y).

The problem is I am in kind of hurry and probably can not wait for the
driver release to solve it. The current workaround I know is to use x1
[] as the indexed array name. However this will pull down the
performance as scratch buffer will be used instead of regs.

So I am wondering if any of you have already met this problem and
already had a better workaround.

The following IL quickly illustrate the bug (in case you don't want to
log on to the forum).

;---------------------------
il_ps_2_0

dcl_literal l0,0,0,0,0
dcl_indexed_temp_array x0[2]
dcl_input_generic vObjIndex0

mov x0[vObjIndex0.x+0], l0
mov r0, x0[vObjIndex0.y+0]
mov g[0], r0

endmain
end
;---------------------------

Compile it with SKA or calcl APIs (driver 9.2), you will find the
compiler thought x0[] is identical to g[]. Changing x0[] to x1[]
solves the problem but eliminates the use of GPRs and A0.

Disassembly code on my machine is:

; -------- Disassembly --------------------
00 ALU: ADDR(32) CNT(5)
0 x: MOV R1.x, 0.0f
y: MOV R1.y, 0.0f
z: MOV R1.z, 0.0f
w: MOV R1.w, 0.0f
t: MOV R2.x, R0.y
01 ALU: ADDR(37) CNT(5)
1 x: MOVA_INT ____, R0.x
2 x: MOV R5[A0.x].x, R1.x
y: MOV R5[A0.x].y, R1.y
z: MOV R5[A0.x].z, R1.z
w: MOV R5[A0.x].w, R1.w
02 ALU: ADDR(42) CNT(13)
3 x: MOVA_INT ____, R2.x
4 x: MOV R2.x, R5[A0.x].x
y: MOV R2.y, R5[A0.x].y
z: MOV R2.z, R5[A0.x].z
w: MOV R2.w, R5[A0.x].w
5 x: MOV R5.x, R2.x
y: MOV R5.y, R2.y
z: MOV R5.z, R2.z
w: MOV R5.w, R2.w
6 x: MOV R2.x, 0.0f
y: MOV R2.y, 0.0f
z: MOV R2.z, 0.0f
w: MOV R2.w, 0.0f
03 EXP_DONE: PIX0, R2
END_OF_PROGRAM

Li John

unread,
Mar 18, 2009, 11:02:10 AM3/18/09
to amd...@googlegroups.com
问题出在下面这句代码,
mov r0, x0[vObjIndex0.y+0]

我觉得有2个问题,
1. 按照IL规范,vObjIndex上的第2、3、4个分量是未定义的。
2. x0只申明了2个元素,但是vObjIndex作为索引值有可能很大,会越界。




2009/3/18 the729 (Wu Tianji) <the...@gmail.com>
Reply all
Reply to author
Forward
0 new messages