[Issue 2278] Guarantee alignment of stack-allocated variables on x86
https://issues.dlang.org/show_bug.cgi?id=2278 Iain Buclaw changed: What|Removed |Added Priority|P2 |P4 --
[Issue 2278] Guarantee alignment of stack-allocated variables on x86
https://d.puremagic.com/issues/show_bug.cgi?id=2278 Denis Shelomovskij verylonglogin@gmail.com changed: What|Removed |Added CC||verylonglogin@gmail.com Severity|regression |enhancement --- Comment #14 from Denis Shelomovskij verylonglogin@gmail.com 2014-03-18 18:00:56 MSK --- This isn't a regression. It was just a luck build in Comment 10. As a [partial] workaround one can use an autoaligned buffer e.g. this one: http://denis-sh.bitbucket.org/unstandard/unstd.memory.misc.html -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 2278] Guarantee alignment of stack-allocated variables on x86
https://d.puremagic.com/issues/show_bug.cgi?id=2278 MCD s_la...@ira.uni-karlsruhe.de changed: What|Removed |Added CC||s_la...@ira.uni-karlsruhe.d ||e --- Comment #13 from MCD s_la...@ira.uni-karlsruhe.de 2014-03-10 07:33:21 PDT --- The problem about alignment of the stack for (128 bit) SSE is, that it even needs to be aligned to 16 byte (or double quadrouble word) boundary for fast access (via aligned moves), 8 byte (or quadword) won't be enough(yes, there are unaligned SSE move instructions, but...). And that's only for basic 128 bit SSE, AVX may take 256 bit or even 512 bit alignment, at least when you need to use fast aligned move instructions. Hopefully, no (pure) 32 bit x86 CPU has 256 or 512 bit AVX registers. However, it's possible to use the upper parts of 256 or 512 bit AVX registers in 32 bit Windows on a 64 bit CPU in 32 bit compatibility mode, but I'm not sure whether older versions of Windows do recognize and correctly save/restore them on context switch, which is essential for using them safely (someone needs to check this out). so here you have it. 32-bit Windows requires 16 byte alignment for SSE. 64-bit Windows already has 16 byte alignment, but may require even more if AVX registers are used. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 2278] Guarantee alignment of stack-allocated variables on x86
https://d.puremagic.com/issues/show_bug.cgi?id=2278 Temtaime temta...@gmail.com changed: What|Removed |Added Severity|enhancement |regression --- Comment #12 from Temtaime temta...@gmail.com 2014-02-19 06:06:01 PST --- BUMP. align(16) struct A { ubyte t; } void main() { A a; writeln(cast(size_t)a % 16); } Prints 4 right now. When it will be fixed? -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 2278] Guarantee alignment of stack-allocated variables on x86
http://d.puremagic.com/issues/show_bug.cgi?id=2278 Temtaime temta...@gmail.com changed: What|Removed |Added CC||temta...@gmail.com --- Comment #11 from Temtaime temta...@gmail.com 2013-08-15 15:47:59 PDT --- BUMP. 2.63.2 regression ? import core.stdc.stdio: printf; align(16) struct Foo { ubyte u; } // struct Foo { ubyte u; } // try this void main() { Foo f1; ubyte[3] b1; Foo f2; ubyte[5] b2; Foo f3; ubyte[7] b3; short s1; Foo f4; printf(%u\n, cast(size_t)f1 % 16); printf(%u\n, cast(size_t)f2 % 16); printf(%u\n, cast(size_t)f3 % 16); printf(%u\n, cast(size_t)f4 % 16); } Output: 8 8 8 8 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 2278] Guarantee alignment of stack-allocated variables on x86
http://d.puremagic.com/issues/show_bug.cgi?id=2278 bearophile_h...@eml.cc changed: What|Removed |Added CC||bearophile_h...@eml.cc --- Comment #10 from bearophile_h...@eml.cc 2012-07-24 06:02:27 PDT --- In DMD 2.060beta this problem seems partially solved, for structs: import core.stdc.stdio: printf; align(16) struct Foo { ubyte u; } // struct Foo { ubyte u; } // try this void main() { Foo f1; ubyte[3] b1; Foo f2; ubyte[5] b2; Foo f3; ubyte[7] b3; short s1; Foo f4; printf(%u\n, cast(size_t)f1 % 16); printf(%u\n, cast(size_t)f2 % 16); printf(%u\n, cast(size_t)f3 % 16); printf(%u\n, cast(size_t)f4 % 16); } Output: 0 0 0 0 But this syntax is not supported yet: void main() { align(16) ubyte u; } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 2278] Guarantee alignment of stack-allocated variables on x86
http://d.puremagic.com/issues/show_bug.cgi?id=2278 Manu turkey...@gmail.com changed: What|Removed |Added CC||turkey...@gmail.com --- Comment #9 from Manu turkey...@gmail.com 2012-05-24 03:08:55 PDT --- I'm at the point where I can't reasonably work around this issue anymore. It's not just for SSE (although that is one very important case), there are also structures that encapsulate SSE variables (16 byte), structures that must be L1 line aligned (64/128 bytes), structures that must be GPU page aligned (4k-ish), virtual page alignment, and occasionally other alignments are required (for instance, in one case an algorithms performance was near doubled by aligning to 256 bytes, and squatting a byte of data in the unused low bits of the pointer) Structure alignment is really really important, and it's very annoying to work-around (and often wastes memory in doing so) As we did with 256bit vectors, can we define the grammar for attributing a struct with an alignment? Then GDC/LDC can hook it straight up, and DMD can produce an unsupported message for the time being. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 2278] Guarantee alignment of stack-allocated variables on x86
http://d.puremagic.com/issues/show_bug.cgi?id=2278 Benjamin Thaut c...@benjamin-thaut.de changed: What|Removed |Added CC||c...@benjamin-thaut.de --- Comment #8 from Benjamin Thaut c...@benjamin-thaut.de 2011-09-21 09:47:09 PDT --- SSE is getting more and more important in performance cirtical applications. There should be at least one way to make shure that a certain variable that is beeing allocated on the stack is aligned. I recently came across this issue in D2. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 2278] Guarantee alignment of stack-allocated variables on x86
http://d.puremagic.com/issues/show_bug.cgi?id=2278 Don clugd...@yahoo.com.au changed: What|Removed |Added CC||bary...@smp.if.uj.edu.pl --- Comment #6 from Don clugd...@yahoo.com.au 2010-01-15 04:51:12 PST --- *** Issue 1847 has been marked as a duplicate of this issue. *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---