* * *

Author Topic: AVX and SSE support question  (Read 2496 times)


  • Newbie
  • Posts: 2
AVX and SSE support question
« on: May 25, 2016, 10:22:03 am »
I have the following code:

  vectorsize = 4;
  tVector=array[0..vectorsize-1] of single;

function vectoradd(a,b:tVector):tVector;
This compiles fine when SSE and vector processing are enabled.

But when I increase vectorsize to 8 and enable the AVX compiler options I get this error:
Compile Project, Target: project1.exe: Exit code 1, Errors: 1
unit1.pas(60,12) Error: Internal error 200610072

Is AVX not properly supported yet by fpc or is this a bug?

I'm using lazarus 64bit version 1.6 with fpc 3.0.0 on Windows 10 x64 with AMD A10 AVX enabled processor.



  • Hero Member
  • *****
  • Posts: 3960
Re: AVX and SSE support question
« Reply #1 on: May 25, 2016, 10:51:56 am »
Which FPC version are you using? That's really important, because AVX is only properly supported from 3.0 and higher.

Ah, I see, 3.0. In that case: how did you compile? An internal error should never happen and should be reported on bugs.freepascal.org. If you ever see an internal error it is a bug by definition.

When you file your bug report give as much information as possible and preferably a complete code example that reproduces the bug.
« Last Edit: May 25, 2016, 10:59:27 am by Thaddy »
"Logically, no number of positive outcomes at the level of experimental testing can confirm a scientific theory, but a single counterexample is logically decisive."


  • Newbie
  • Posts: 2
Re: AVX and SSE support question
« Reply #2 on: May 25, 2016, 11:49:38 am »
Ok, thanks, I will file a bug report soon. I use a new lazarus project only adding the code I produced in my post and having these compiler options specified:

Pascal Fan

  • Newbie
  • Posts: 2
Re: AVX and SSE support question
« Reply #3 on: June 11, 2016, 05:46:05 am »
I noticed something else related to the vector processing.  I was playing around with this code this evening, trying a few things, and I noticed that when I used the code posted in this thread with a vector size of 4, and enabled SSE and vector processing with FPC 3.0, I got the same internal error as the poster got when using AVX with a size of 8, if I did an "a xor b" operation instead of an "a + b" operation.  If I did the "a + b" operation as shown in this thread, it works with SSE, but an xor operation will trigger the internal error.  I suspect this isn't correct, because it seems like an xor operation should be possible, and in any event the internal error seems like it's not the correct response.  Anyhow, I thought I should mention it because it looks like there might be some issues with the SSE vector processing as well.
« Last Edit: June 11, 2016, 05:51:36 am by Pascal Fan »


  • Sr. Member
  • ****
  • Posts: 275
  • .
Re: AVX and SSE support question
« Reply #4 on: June 11, 2016, 06:13:26 am »
maybe you should refrain from using -O4 since the compiler help screens contains the following:
Code: [Select]
  -O<x>  Optimizations:
      -O-        Disable optimizations
      -O1        Level 1 optimizations (quick and debugger friendly)
      -O2        Level 2 optimizations (-O1 + quick optimizations)
      -O3        Level 3 optimizations (-O2 + slow optimizations)
      -O4        Level 4 optimizations (-O3 + optimizations which might have unexpected side effects)

maybe I'm wrong.

Pascal Fan

  • Newbie
  • Posts: 2
Re: AVX and SSE support question
« Reply #5 on: June 11, 2016, 06:54:07 am »
That's a totally valid point, and you're absolutely correct,  but what I forgot to mention in my post is that my compiles were done with -O3, not the -O4 the original poster used.  So I do think there might be a legitimate bug here.  But you are absolutely correct that -O4 is probably not a good idea!



Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus