One of my customers complains, that he cannot start one of the programs because his computer does not support AVX. In the FTN95 help files I did not find a clear definition what the compiler is doing with SSE / AVX .
AVX required ?
This is a quick response. I can look at it in more detail later.
clearwin64.dll uses AVX instructions but only for routines like DOT_PRODUCT8@ when they are called directly in the Fortran code. One question is, does the presence of these routines cause a problem even when they are not called?
There again, routines like DOT_PRODUCT8@ only use AVX instructions when they are supported by the CPU.
Another question is, is AVX available but switched off on the end user's machine. AVX can be switched off via ''bcdedit /set xsavedisable 0'. As a developer you can use this command (reboot needed) to test what happens to your application when AVX is disabled.
Correction and warning:
- The value to use with xsavedisable is 1 and not 0.
- My own experience with using bcdedit in this way was quite unpleasant. At one point my machine failed to reboot until I used safe mode which is a long and tedious process under Windows 10. When using bcdedit it is vital that you first set up a process for backup and recover.
- It turned out that the issue here relates to the fact that /64 /OPT creates an executable that will not load on a machine that does not support AVX.
There was a problem reported on the Forum that may be similar but I can't find it now. That problem was fixed by using a later build of clearwin64.dll. The current version should be OK. (note that clearwin64.dll is twinned with salflibc64.dll and these should always be shipped together).
Here is a list of routines that explicitly use AVX when it is supported otherwise they use SSE (SSE2 I guess).
DOT_PRODUCT8@ DOT_PRODUCT4@ AXPY8@ AXPY4@ also the standard intrinsic DOT_PRODUCT when the array size is large and is known at compile time.
clearwin64.dll is built using a Microsoft C++ compiler and there is an AVX option on the compiler command line which may be relevant. It is possible that Microsoft uses AVX in some way (in addition to our explicit use in clearwin64.dll).
On Monday I will aim to run some tests, after switching off AVX support on my machine, to see if this provides any insight.
If you know what CPU the end-user has then you can find out if it supports AVX and hence if they might have AVX support switched off on their machine.
Paul, thanks for your explanations. From my experience a program do not start at all if it contains AVX parts but the computer does not support AVX. I checked my program which causes the problem. There is definitely no call to any DOT or AXPY routine; as well not in the included library functions. However, I found in the map file: '__test_avx - SALFLIBC64.DLL'. This might be the problem.
I cannot switch off AVX because I provide my large number crunching program in two versions: AVX and SSE3. It will be compiled by Intel Fortran. There I can explicitly define which code generation shall be used. Your compiler decides automatically about code generation. Because of the problems I need to select by myself the type of code generation.
Erwin
Erwin
__test_avx will not cause a problem. It works for any CPU.
I was suggesting that you switch off AVX only as a temporary test, the make sure that clearwin64.dll loads and runs correctly without AVX.
At the moment FTN95 does not have an AVX switch on the command line. In certain situations it uses AVX when available but it is not dependent on AVX.
Paul
Paul,
I tried to switch AVX off with your command. But it did not work, otherwise my program compiled (iFort) to use AVX should not have started.
Erwin
Erwin
Did you remember to reboot after the command?
of course
It turns out that AVX support can't be switched off (at least I have not been able to do so). So I can't test this on my current machine.
If anyone has easy access to a 64 bit machine that does not support AVX can you please test if clearwin64.dll loads correctly. My current understanding is that there should be no problem. Any program that calls winio@, for example, would provide a suitable test.
Paul,
it's vice versa: 'bcdedit /set xsavedisable 1' switches AVX off. The message then is: Silverfrost exception report on BBman.exe FTN95 optimised code needs AVX CPU capability at address 1c0084dd Within file BBman.exe
Would the map file help you? I coud send it to your private email address.
Erwin
Erwin
Thank you. Now I understand what is happening.
If you create your executable with /64 and /OPT then the executable will fail to load (on a machine without AVX) and it will generate this runtime error report.
This restriction is not actually needed right now. It has been included for the purposes of ongoing development in which we aim to use AVX in the outcome of the optimisation process.
For an immediate fix you could switch off FTN95 optimisation either generally or for this particular end user. Your choice may depend on how much improvement you get with /OPT applied.
Another possibility is for us to provide a switch on the SLINK64 command line to over-ride this restriction but that may not be easy and so could be costly in one way or another.
Paul, I have switched off AVX, compiled all libraries and the program anew, but I receive still the same error message. Erwin
Erwin
At the moment you can not use FTN95 /OPT /64 on a machine that does not have AVX support. Have you built using /OPT?
Quoted from PaulLaidler Erwin
At the moment you can not use FTN95 /OPT /64 on a machine that does not have AVX support. Have you built using /OPT?
That limitation is a rather unexpected handicap when the program does only integer and character processing; such a program would not use AVX instructions even if they were available (well, the RTL may contain AVX code that gets run even when the user's code is all-integer).
I hope that this restriction will be removed or relaxed in future versions of FTN95.
What processors are there that support 64-bit, but don't have AVX support ? I am thinking that it is a small group, but I may be surprised. I am equating AVX with improved performance so if you need a large memory solution, wouldn't you need good performance.
John
( I have just purchased an i7-8700K and it is actually faster for AVX instructions. Same clock rate but faster memory, more cache > faster performance )
It would be a simple matter to provide an option that removes the restriction and this may be helpful in the short term when there are still a few end users with non-AVX 64 bit processors.
I have three of those customers under maintenance.
Paul, it would be really helpfull to have an option to switch AVX off, and it would save me a lot of time.
Erwin
I can add an option today but I am not sure how soon it will be before we deliver a new FTN95.
Paul, is there any possibility to receive it in advance?