cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

frankas
Journeyman III

IL compiler problem. (Unrolls lops, and generates faulty image)

Unrolls lops, and generates faulty image

My kernel compiles, but disassembly shows that my loops have been unrolled completely, and at the end I get:

    1388  x: AND_INT     R26.x,  T3.x,  1     
         y: AND_INT     ____,  R20.w,  1     
         z: LSHL        ____,  R26.x,  1      VEC_120
         w: LSHL        ____,  R22.y,  1     
         t: LSHL        ____,  R15.z,  1     
65 NOP NO_BARRIER
66 NOP NO_BARRIER
67 NOP NO_BARRIER
68 NOP NO_BARRIER

[SNIP]

95 NOP NO_BARRIER
96 NOP NO_BARRIER
97 ALU: ADDR(2072577) CNT(1) NO_BARRIER
Error: Clause @ addr 16580616 (count=1, size=8) falls out of program range (size=62368).
Likely incorrect clause addr or slot count specified.

If I try to run this kernel I get a complete driver crash (execution takes too long and 1 CPU core freezes on Linux)

I tried googling for the error message but came up empty, and I can't find a way to more explicitly control loop unrolling. EDIT: The problem seems to be caused by having 2 while loops in the same kernel, using just a single loop worked.

The loop construct is attached as code

(I never could figure out how to use the loop instruction)

 

mov r99.x,l15.x whileloop iadd r99.x,r99.x,l2.x if_logicalz r99.x break endif ... endloop

0 Likes
2 Replies
frankas
Journeyman III

Decrementing the loop counter at the end of the loop generates valid code. And doesn't crash my computer. So it seem that it is my unusual loop construct that gets the compilers knickers in a twist.

 

Attached is working non-crashing code snippet.

mov r99.x,l15.x whileloop if_logicalz r99.x break endif ... iadd r99.x,r99.x,l2.x endloop

0 Likes

frankas,

to restrict the compiler to completely unroll the loop,you need to specify the limit of loop such that it cannot be determined at compile time.

do not give any hardcoded value as the loop limit.

0 Likes