7 Replies Latest reply on Feb 21, 2009 8:17 PM by rick.weber

    Are there any real functions @ AMD IL?

    empty_knapsack
      AMD IL functions support

      I'm trying to figure out how AMD IL works. I've code that looks like:

      mov r<0-15>, params#1

      call 1

      mov r<0-15>, params#2

      call 1

      mov r<0-15>, params#3

      call 1

      ... etc

      func 1

      // kinda lot of code here

      ...

      ret

       

      When i'm trying to compile it it stucks at calclCompile() phase. As I can understand the reason is that CAL trying to inline everything. The questions are: is this normal behaviour? Am I missed some <noinline> thing? Are there any real functions with <call/ret> accessible via AMD IL?

      // And as a side note -- kinda strange that pdf documentation have "no clipboard copy allowed" attribute .

       

       

        • Are there any real functions @ AMD IL?
          rick.weber

          In IL, you can make actual function calls (even recursive ones). The instruction for returning from a function is ret_dyn, not ret.

            • Are there any real functions @ AMD IL?
              empty_knapsack

               

              Originally posted by: rick.weber In IL, you can make actual function calls (even recursive ones). The instruction for returning from a function is ret_dyn, not ret.

              In fact it was ret_dyn, I've just incorrectly called it "ret" (not so familiar with IL atm while having long x86 history). More correctly, my kernel looks like:

              il_ps_2_0
              dcl_input_position_interp(linear_noperspective) vWinCoord0.xy__
              dcl_output_generic o0
              ...

              ; setting up params #1

              call 1
              ; setting up params #2

              call 1

              ; more and more similar code, 19x times

              ...

              mov o0,r10
              mov o1,r11
              mov o2,r12
              mov o3,r13
              mov o4,r14
              endmain

              func 1
              ; (big) function body here

              ret_dyn
              endfunc

              end

              It still hangs on compiling phase. And I can't find something that looks like "call/ret" when disassembling the kernel (and when using lesser numbers of functions' calls to avoid compiler lock up).

               

                • Are there any real functions @ AMD IL?
                  rick.weber

                  Try putting a ret_dyn before endmain. If that doesn't work, then comment out blocks of lines until you can isolate the ones that are causing compilation to fail. It would be helpful if getting the error string told you what line was wrong, but when I tried it, it said "no error."

                    • Are there any real functions @ AMD IL?
                      empty_knapsack

                      Tried ret_dyn before endmain -- nothing changed.

                      And in fact there no error strings at all -- it just hangs up while compiling. C++ wrapper looks like:

                       printf("Compiling kernel...\n");
                       if (calclCompile(&obj, lang, pDecompressed, info.target) != CAL_RESULT_OK) {
                         fprintf(stdout, "Kernel compilation failed. Exiting.\n");
                         return 1;
                       }
                       printf("Compiling done, linking...\n");
                       if (calclLink(&image, &obj, 1) != CAL_RESULT_OK) {
                         fprintf(stdout, "Kernel linking failed. Exiting.\n");
                         return 1;
                       }
                      // calclDisassembleImage(image, (CALLogFunction)__logger); return 0;
                       
                       printf("Linking done, preparing to run\n");

                      After outputting "Compiling kernel..." nothing happens, it just hangs up. I've waited for 10 mins just to be sure . Long kernels takes some time to compile (i've got 30 sec on some really big one) but 10+ mins can't be good anyway.

                       

                      If I'm reducing number of functions calls at some point kernel became compilable but it takes time (several seconds), result disassembly really big (1M+) and there no CALL/RET keywords inside. That why I assume that calCL just inlining my function instead of calling it.