Constant buffers naming convention in Brook kernel generated IL

Discussion created by jean-claude on Dec 23, 2008
Latest reply on Dec 23, 2008 by gaurav.garg
using brook generated IL in CAL

Hi Gaurav,

If my understanding is correct there are 15 constant buffers,
which can contain upto 1024*4 elements.

The naming goes from cb0 to cb14.

So consider the following kernel

kernel void k_trial(out float A<>, float BO<>, float B1<>, float C0, float C1) {
    A = B0*C0 + B1*C1;

To use the generated IL in CAL, I would assume the following naming for binding:

input            A  <=>  o0

outputs        B0 <=>  i0        B1 <=>  i1

constants     C0 <=>  cb0      C1 <=>  cb1

That sounds fine for input & outputs, but for constants it seems that there
are both folded in cb0 through :

dcl_cb cb0[2]


(1) so what are the variable names for C0 and C1 ?

    CALname C0_name = 0;
    calModuleGetName(&C0_name,  ctx, module_k_trial, "???");
    calCtxSetMem(ctx, C0_name, C0_Mem);

    CALname C1_name = 0;
    calModuleGetName(&C1_name,  ctx, module_k_trial, "???");

(2) is this to say that for n constants the generated IL would be dcl_cb cb0[n]?
    but then when are cb1, ..., cb14 used?


Thanks for some hints.