Re: core.simd and dynamic arrays

2025-01-27 Thread John C. via Digitalmars-d-learn
On Monday, 27 January 2025 at 15:55:17 UTC, Guillaume Piolat wrote: You may use intel-intrinsics who: 1. guarantees float8 is there 2. have aligned malloc _mm_malloc I have heard about intel-intrinsics and it's really good idea to use it in my code, but I wanted to try some SIMD operations wit

Re: core.simd and dynamic arrays

2025-01-27 Thread Johan via Digitalmars-d-learn
On Monday, 27 January 2025 at 05:53:09 UTC, John C. wrote: On Sunday, 26 January 2025 at 16:43:19 UTC, Johan wrote: The `align(32)` applies to the slice `a`, not the contents of `a` (where `a` points to). Thank you, seems that it is reason for that errors. I remember that dynamic array can be

Re: core.simd and dynamic arrays

2025-01-27 Thread Guillaume Piolat via Digitalmars-d-learn
On Monday, 27 January 2025 at 05:57:18 UTC, John C. wrote: On Monday, 27 January 2025 at 05:53:09 UTC, John C. wrote: Print out the pointer to `a[0]` to verify what the actual alignment is. If we look to output above, first line addresses are aligned to 32 bytes Except address with B(1011)

Re: core.simd and dynamic arrays

2025-01-26 Thread John C. via Digitalmars-d-learn
On Monday, 27 January 2025 at 05:53:09 UTC, John C. wrote: Print out the pointer to `a[0]` to verify what the actual alignment is. If we look to output above, first line addresses are aligned to 32 bytes Except address with B(1011) at second from the right position?

Re: core.simd and dynamic arrays

2025-01-26 Thread John C. via Digitalmars-d-learn
On Sunday, 26 January 2025 at 16:43:19 UTC, Johan wrote: The `align(32)` applies to the slice `a`, not the contents of `a` (where `a` points to). Thank you, seems that it is reason for that errors. I remember that dynamic array can be represented as structure with size_t len and pointer to me

Re: core.simd and dynamic arrays

2025-01-26 Thread Johan via Digitalmars-d-learn
On Sunday, 26 January 2025 at 12:45:11 UTC, John C. wrote: Hello everyone. I am complete newbie in D and programming at all and I can't understand why dynamic arrays can't be used within following D code: ```d import std.random : uniform01; import core.simd; void main() { align(32) float[]

Re: core.simd and dynamic arrays

2025-01-26 Thread John C. via Digitalmars-d-learn
On Sunday, 26 January 2025 at 13:59:09 UTC, John C. wrote: I have tested this code with LDC on run.dlang.io, segmentation fault does occur only if -mattr=+avx is used. Without this flag no errors are produced. Actually, if I use -mcpu=avx with DMD, no error is generated. However, if this flag

Re: core.simd and dynamic arrays

2025-01-26 Thread John C. via Digitalmars-d-learn
On Sunday, 26 January 2025 at 12:45:11 UTC, John C. wrote: I'm using LDC compiler 1.36.0 on x86_64 Linux system with "-w -O3 -mattr=+avx" compiler flags. I have tested this code with LDC on run.dlang.io, segmentation fault does occur only if -mattr=+avx is used. Without this flag no errors ar

Re: core.simd and dynamic arrays

2025-01-26 Thread John C. via Digitalmars-d-learn
On Sunday, 26 January 2025 at 12:56:55 UTC, ryuukk_ wrote: LDC 1.36 = 1 years old latest version is LDC 1.40 with LDC 1.40, your code works on my computer now my turn to ask a question: why were you using a 1 years old compiler version? common sense would be to make sure you are up to dat

Re: core.simd and dynamic arrays

2025-01-26 Thread Steven Schveighoffer via Digitalmars-d-learn
On Sunday, 26 January 2025 at 12:56:55 UTC, ryuukk_ wrote: common sense would be to make sure you are up to date before wondering why it's broken This is the learn forum. People are learning here. Try to be nicer, there is no need for this. -Steve

Re: core.simd and dynamic arrays

2025-01-26 Thread ryuukk_ via Digitalmars-d-learn
LDC 1.36 = 1 years old latest version is LDC 1.40 with LDC 1.40, your code works on my computer now my turn to ask a question: why were you using a 1 years old compiler version? common sense would be to make sure you are up to date before wondering why it's broken