Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

Journeyman III

IL loop and relative addessing with aL

Hi All,

In the attached code I have a simple computer shader which is using the IL loop command  (as I would like to use the aL register inside the loop).  The problem is it does not stop looping at r0.x, as the docs say it should, but always iterates 255 times, unless the break instuction inside is invoked. 

Also, how to specify the [repeat] option for loop.  Nothing I could imagine compiled.

Any ideas? Thanks.


il_cs_2_0 dcl_num_thread_per_group 64 dcl_literal l0, 0x00000004, 0x0000007f, 0x00000000, 0x00000001 dcl_literal l1, 0x0000ffff, 0x0, 0x0, 0x0 ; specify aL register starting value for loop mov r0.y, l0.z ; specify aL step mov r0.z, l0.w ; accumulator to output to g[] to see whats going on mov r1.x, l0.z ; filler mov r1._yzw, l0._xwx ; ensure we have a sane loop count mov r0.x, l0.x ; how to specify the [repeat] loop option here? loop r0 ; inc the accumulator iadd r1.x, r1.x, l0.w ; loop safety to get out a l1.x loop counts ige r2.x, r1.x, l1.x break_logicalnz r2.x endloop ; generate some output mov g[vaTid.x], r1 end

1 Reply
Journeyman III

I found this DX assembly reference

Is the loop instruction even supported in il_cs_2_0 kernels?

The instruction to set the loop constants does not compile

defi i3, 10,1,2,0

A literal

dcl_literal l3, 10,1,2,0

loop l3



does compile, but still it loops 256 times, and not the expected 10 times, as indicated by a counter inside the loop.