Results 1 to 3 of 3

Thread: initializing __constant vector arrays

  1. #1
    Junior Member
    Join Date
    Sep 2009
    Posts
    1

    initializing __constant vector arrays

    As a global variable, I have
    Code :
    __constant int2 diamond[2][2] =
    {
        {(int2)(-1,0), (int2)(0, 1)},
        {(int2)( 1,0), (int2)(0,-1)}
    };
    This doesn't compile on snow leopard targeting a GF 8600M, with the error "Error while compiling the ptx module: CLH_ERROR_NO_BINARY_FOR_GPU"

    Is this correct syntax? If not, what is the correct way to have array of vectors in constant memory without initializing it from the host?

  2. #2

    Re: initializing __constant vector arrays

    I've just cut and pasted that snippet into the top of my kernel, and compiled it fine for the CPU and GPU. I think that means the syntax is OK, but then I'm not actually accessing it so it's probably optimised out.

    I've also had that error from the SL compiler for the 8xxx series.

    For me it seemed to be related to accessing arrays which were memory objects.

    e.g. (heavily simplified):
    Code :
    kernel void particle(float * positions) {
        float4 position = vload4(0, positions + i * 3);

    I'm not sure if it's the possible mis-aligned load that's causing the problem, but I'd be interested to see if you have something similar.

    This was in a context with shared OpenGL objects, on 10.6.1. Compiling for the CPU gives no problems. It may also be working in a non-shared context on the GPU, but I'm having other problem with that that may be clouding the issue.

  3. #3

    Re: initializing __constant vector arrays

    I've found it was nothing to do with accessing anything, just that it seems having arrays defined as constant seems to blow things up.

    Mine were "constant float *". Making that "global float *" solved the problem for me.

Similar Threads

  1. Replies: 0
    Last Post: 01-31-2012, 10:29 AM
  2. Replies: 1
    Last Post: 10-01-2009, 05:04 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •