Re: alignment on stack-allocated arrays/structs

2009-11-18 Thread Don
Trass3r wrote: Don schrieb: Well, sort of. It's impossible to align stack-allocated structs with any alignment greater than the alignment of the stack itself (which is 4 bytes). Anything larger than that and you HAVE to use the heap or alloca(). So how do other compilers supporting that al

Re: alignment on stack-allocated arrays/structs

2009-11-18 Thread Trass3r
Don schrieb: Well, sort of. It's impossible to align stack-allocated structs with any alignment greater than the alignment of the stack itself (which is 4 bytes). Anything larger than that and you HAVE to use the heap or alloca(). So how do other compilers supporting that alignment syntax d

Re: alignment on stack-allocated arrays/structs

2009-11-18 Thread Robert Jacques
On Wed, 18 Nov 2009 11:03:19 -0500, Don wrote: Trass3r wrote: Don schrieb: http://d.puremagic.com/issues/show_bug.cgi?id=2278 Isn't this a distinct problem or am I wrong? This is not only about 8-byte boundaries. Well, sort of. It's impossible to align stack-allocated structs with any al

Re: alignment on stack-allocated arrays/structs

2009-11-18 Thread Don
Trass3r wrote: Don schrieb: http://d.puremagic.com/issues/show_bug.cgi?id=2278 Isn't this a distinct problem or am I wrong? This is not only about 8-byte boundaries. Well, sort of. It's impossible to align stack-allocated structs with any alignment greater than the alignment of the stack i

Re: alignment on stack-allocated arrays/structs

2009-11-18 Thread Trass3r
Don schrieb: http://d.puremagic.com/issues/show_bug.cgi?id=2278 Isn't this a distinct problem or am I wrong? This is not only about 8-byte boundaries.

Re: alignment on stack-allocated arrays/structs

2009-11-18 Thread Don
OpenCL requires all types to be naturally aligned. /* * Vector types * * Note: OpenCL requires that all types be naturally aligned. * This means that vector types must be naturally aligned. * For example, a vector of four floats must be aligned to * a 16 byte

Re: alignment on stack-allocated arrays/structs

2009-11-17 Thread Trass3r
Robert Jacques schrieb: To the best of my knowlegde, D only supports align(1) and align(4). On the other hand, compile time introspection allows my CUDA api to convert alignment correctly for any given struct. gotta look that up in your code. Maybe I also find some other ideas for writing m

Re: alignment on stack-allocated arrays/structs

2009-11-17 Thread Robert Jacques
On Tue, 17 Nov 2009 15:12:50 -0500, Trass3r wrote: I originally posted a question about this in D.learn. bearophile advised me to ask for that feature here. Original post: == OpenCL requires all types to be naturally aligned. The D specs state: "AlignAttribute is ignored when

Re: alignment on stack-allocated arrays/structs

2009-11-17 Thread bearophile
Tomas Lindquist Olsen: > yep, D provides no way to do this, they'd all align to 4 bytes (at > least on x86-32) The idea, that I suggested to the LDC team too, is to extend the semantics of align, no new syntax seems needed: align(8) alias int[4] Foo; align(8) double good; Bye, bearophile

Re: alignment on stack-allocated arrays/structs

2009-11-17 Thread Tomas Lindquist Olsen
On Tue, Nov 17, 2009 at 9:12 PM, Trass3r wrote: > I originally posted a question about this in D.learn. bearophile advised me > to ask for that feature here. > > > Original post: > == > > OpenCL requires all types to be naturally aligned. > > The D specs state: > "AlignAttribute is ign

alignment on stack-allocated arrays/structs

2009-11-17 Thread Trass3r
I originally posted a question about this in D.learn. bearophile advised me to ask for that feature here. Original post: == OpenCL requires all types to be naturally aligned. The D specs state: "AlignAttribute is ignored when applied to declarations that are not struct members."