Results 1 to 2 of 2

Thread: Size of a structure. Should it be multiple of 16 ?

  1. #1
    Junior Member
    Join Date
    Apr 2010

    Size of a structure. Should it be multiple of 16 ?

    I wonder that my own structure shoulde have the size of multiple of 16 bytes.
    I remember that I read a post saying it would be better to make the size of a structure be multiple of 16. However, I'm not sure that.

    If I define a structure like this, the size of A is 20 bytes.

    Code :
    Struct A 
       float a, b, c, d ;
       int k ;

    Considering memory access, I think 20 bytes is not a good size since OpenCL works with numbers, such as 16, 32, 128.

    Thanks in advance !

  2. #2
    Junior Member
    Join Date
    Mar 2010

    Re: Size of a structure. Should it be multiple of 16 ?

    Well the aligment multiple by 16 comes by the way the SIMT pushes the work on the computeElements. There exists some called HalfWarp, that consist on 16 workItems that have a determinated size in Bytes of aligment, so this halfwarp reads the memory and produce this access in a determinated way, if your size of half warp is p.e. 32B, then yo have and overhead of 12B per lecture (this is because you have your estructure of 20B). It's clear?


Similar Threads

  1. OpenCL Ndrange Global Size/Local Size
    By BiS in forum OpenCL
    Replies: 4
    Last Post: 01-04-2013, 07:52 AM
  2. buffer for structure
    By agmegharaj in forum OpenCL
    Replies: 0
    Last Post: 08-31-2011, 09:51 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