4 Replies Latest reply on Dec 25, 2008 11:15 AM by gaurav.garg

    use il generated by brook+ in cal

    lxp121

      write il is a very difficult things!

      so i want use Brook+ to generate il code, and use it in cal.

      but, here's the thing. the Brook+ use address virtualization, so i must give a "cb0[2]". what is that? is it the execution domain of kernel? or the domain of stream?

      another question : if i have to gather stream in one kernel but with different domain (and this domain also different from domain of kernel), how does it works?

      for example:

      kernel void test(float a[], float b[], out float c[])

      a,b,c and kernel have different domain. is this legal? how can the compiler know the difference?

        • use il generated by brook+ in cal
          gaurav.garg

          Hi lxp121,

           

          If you look closely Brook+ generates two il shaders one with AT(address virtualization) and another on without AT. Using non-AT kernel should be straight forward. It doesn't generate any extra constants. Try compiling your shader with -k option. It will generate two .il file. The file without "_addr" should be used.

          Using different domains on your input, output or kernel is allowed. Using domain on input or output is like passing a new stream to the kernel. Setting kernel domain is equaivalent to specifying a region of execution and has the same effect as in CAL. Consider this example -

          kernel void test(float a[], float b[], out float c[])
          {
              int id = instance().x; // Its value is decided by kernel execution specified
              c[id + 1] = a[0] + b[id + 2]; // Indexing for all the streams  start from (0,0) irrespective of their domain set at runtime.
          }


          // Set execution domain of kernel
          test.domainOffset(uint4(1, 0, 0, 0));
          test.domainSize(uint4(5, 1, 1, 1));

          test(a.domain(5, 10), b.domain(15, 25), c.domain(8, 16));

           I haven't checked it but the affect of this kernel should be -

          c[9 to 14] = a[5] + b[18 to 23];

           

          Hope it helps.

            • use il generated by brook+ in cal
              lxp121

              your answer is impressive!

              i will try this!

              thanks!

              • use il generated by brook+ in cal
                traits

                 

                Originally posted by: gaurav.garg Hi lxp121,

                 

                 

                 

                If you look closely Brook+ generates two il shaders one with AT(address virtualization) and another on without AT. Using non-AT kernel should be straight forward. It doesn't generate any extra constants. Try compiling your shader with -k option. It will generate two .il file. The file without "_addr" should be used.

                 

                Using different domains on your input, output or kernel is allowed. Using domain on input or output is like passing a new stream to the kernel. Setting kernel domain is equaivalent to specifying a region of execution and has the same effect as in CAL. Consider this example -

                 

                kernel void test(float a[], float b[], out float c[]) {     int id = instance().x; // Its value is decided by kernel execution specified     c[id + 1] = a[0] + b[id + 2]; // Indexing for all the streams  start from (0,0) irrespective of their domain set at runtime. } // Set execution domain of kernel test.domainOffset(uint4(1, 0, 0, 0)); test.domainSize(uint4(5, 1, 1, 1)); test(a.domain(5, 10), b.domain(15, 25), c.domain(8, 16));  I haven't checked it but the affect of this kernel should be - c[9 to 14] = a[5] + b[18 to 23];

                 

                 

                 

                 

                Why not c[10 to 15]?

                I don't understand kernel domain offset and size clearly. Could you explain it carefully?