<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[AVX Intrinsics - Speicherzugriffsfehler]]></title><description><![CDATA[<p>Kann mir jmd erklären, wieso das zu einem Speicherzugriffsfehler führt?</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;immintrin.h&gt;

using namespace std;

int main()
{
  double *x = (double*) malloc(4 * sizeof(double));
  double *y = (double*) malloc(4 * sizeof(double));

  x[0] = 1; y[0] = 1.23;
  x[1] = 2; y[1] = 2.34;
  x[2] = 3; y[2] = 3.45;
  x[3] = 4; y[3] = 4.56;

 double *r = (double*) malloc(4 * sizeof(double));

  __m256d* vx = (__m256d*) x;
  __m256d* vy = (__m256d*) y;
  __m256d* vr = (__m256d*) r;

  vr[0] = _mm256_add_pd( vx[0], vy[0]);

  for(int i=0; i &lt; 4; i++)
    cout &lt;&lt; r[i] &lt;&lt; endl;

  return 0;
}
</code></pre>
<p>Ich hatte schon ein ähnliches Beispiel probiert, welches ohne Probleme funktioniert. ABer das hier will nicht und ich sehe nicht, warum ...</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/311842/avx-intrinsics-speicherzugriffsfehler</link><generator>RSS for Node</generator><lastBuildDate>Mon, 03 Aug 2026 11:30:48 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/311842.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 16 Dec 2012 12:20:40 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to AVX Intrinsics - Speicherzugriffsfehler on Sun, 16 Dec 2012 12:20:40 GMT]]></title><description><![CDATA[<p>Kann mir jmd erklären, wieso das zu einem Speicherzugriffsfehler führt?</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;immintrin.h&gt;

using namespace std;

int main()
{
  double *x = (double*) malloc(4 * sizeof(double));
  double *y = (double*) malloc(4 * sizeof(double));

  x[0] = 1; y[0] = 1.23;
  x[1] = 2; y[1] = 2.34;
  x[2] = 3; y[2] = 3.45;
  x[3] = 4; y[3] = 4.56;

 double *r = (double*) malloc(4 * sizeof(double));

  __m256d* vx = (__m256d*) x;
  __m256d* vy = (__m256d*) y;
  __m256d* vr = (__m256d*) r;

  vr[0] = _mm256_add_pd( vx[0], vy[0]);

  for(int i=0; i &lt; 4; i++)
    cout &lt;&lt; r[i] &lt;&lt; endl;

  return 0;
}
</code></pre>
<p>Ich hatte schon ein ähnliches Beispiel probiert, welches ohne Probleme funktioniert. ABer das hier will nicht und ich sehe nicht, warum ...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2280576</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2280576</guid><dc:creator><![CDATA[shisha]]></dc:creator><pubDate>Sun, 16 Dec 2012 12:20:40 GMT</pubDate></item><item><title><![CDATA[Reply to AVX Intrinsics - Speicherzugriffsfehler on Sun, 16 Dec 2012 12:26:04 GMT]]></title><description><![CDATA[<p>__m256d muss auf 32 Byte ausgerichtet sein. Vermutlich macht malloc das schlicht nicht.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2280578</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2280578</guid><dc:creator><![CDATA[seldon]]></dc:creator><pubDate>Sun, 16 Dec 2012 12:26:04 GMT</pubDate></item><item><title><![CDATA[Reply to AVX Intrinsics - Speicherzugriffsfehler on Sun, 16 Dec 2012 12:43:42 GMT]]></title><description><![CDATA[<p>seldon schrieb:</p>
<blockquote>
<p>__m256d muss auf 32 Byte ausgerichtet sein. Vermutlich macht malloc das schlicht nicht.</p>
</blockquote>
<p>So siehts aus. memalign wirkt wunder. In meinem vorigen Beispiel habe ich kein manuelles Alignment eingebracht, aber es hat funtioniert.</p>
<p>Eventuell war eine bestimmte Compileroption für ALignments gesetzt?</p>
<p>Von sowas hatte ich mal gehört für g++, kann es im Moment aber nicht finden.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2280580</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2280580</guid><dc:creator><![CDATA[shisha]]></dc:creator><pubDate>Sun, 16 Dec 2012 12:43:42 GMT</pubDate></item></channel></rss>