patchGNU Autoconf Archive - Patches: patch #8084, av_ext's AVX check doesn't...


patch #8084: av_ext's AVX check doesn't determine if OS actually supports AVX

Submitter:  Michael Petch <mdpetch>
Submitted:  Thu 20 Jun 2013 08:37:24 PM UTC
Priority:  5 - Normal Status:  Done
Assigned to:  simons Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup

Jump to the original submission

Sat 06 Jul 2013 09:36:06 AM UTC, comment #8: 

Pushed in commit 3551eeb56bcb7a79b348ad1d175004d6d34cfafb. Thank you very much for your efforts!

Peter Simons <simons>
Group administrator
Fri 05 Jul 2013 02:25:46 PM UTC, comment #7: 

I have attached a complete patch against GIT that includes the changes to ax_ext.m4 and the addition of the new file ax_gcc_x86_avx_xgetbv.m4 . Sorry about the previous patch format.

(file #28488)

Michael Petch <mdpetch>
Fri 05 Jul 2013 11:26:29 AM UTC, comment #6: 

I tried to apply the latest version of the patch, but I ran into trouble:

patching file ax_ext.m4
Hunk #2 FAILED at 64.
Hunk #3 FAILED at 126.
Hunk #4 succeeded at 132 (offset -16 lines).
Hunk #5 succeeded at 142 (offset -16 lines).
Hunk #6 succeeded at 152 (offset -16 lines).
Hunk #7 succeeded at 162 (offset -16 lines).
Hunk #8 succeeded at 172 (offset -16 lines).
Hunk #9 succeeded at 182 (offset -16 lines).
Hunk #10 succeeded at 192 (offset -16 lines).
Hunk #11 succeeded at 202 (offset -16 lines).
2 out of 11 hunks FAILED -- saving rejects to file ax_ext.m4.rej

If you have the chance, could you please update the patch relative to the latest Git version and attach it once more? I am really sorry about the inconvenience!

Peter Simons <simons>
Group administrator
Mon 24 Jun 2013 04:55:48 PM UTC, comment #5: 

The new patch ax_ext.m4.patch2 is applied against the git version of ax_ext.m4 and not against my previous patched file.

Michael Petch <mdpetch>
Mon 24 Jun 2013 04:52:53 PM UTC, comment #4: 

I am supplying an updated patch for my original(ax_ext.m4.patch2) . The rationale for this update isn't because the original logic was incorrect, it unfortunately had side effects on some OS's when the xgetbv function wasn't a legal instruction on the processor. In particular when built for MS Windows (Using MinGW) executing xgetbv on an non-AVX enabled processor ended up being trapped by the OS and a modal dialog box being presented to the user. Of course for a make process that is bad.

The macro was modified to only execute xgetbv if we detect an AVX enabled CPU. The macro was also was modified to make sure the autoconf output didn't get nested. I also cleaned up some of the English in the output.

(file #28399)

Michael Petch <mdpetch>
Fri 21 Jun 2013 01:26:38 PM UTC, comment #3: 

Yes sounds good to me, I wasn't aware of the necessity to check another register to see if avx is supprted by OS.


Christophe Tournayre <ctournayre>
Thu 20 Jun 2013 09:47:35 PM UTC, comment #2: 

Christophe, do you have any thoughts on the suggested patch?

Peter Simons <simons>
Group administrator
Thu 20 Jun 2013 08:38:56 PM UTC, comment #1: 

Bug title should have said "ax_ext's AVX check"

Michael Petch <mdpetch>
Thu 20 Jun 2013 08:37:24 PM UTC, original submission:  

Per the Intel documentation (see section 13.8.1): ) and

ax_ext.m4 checks for different SIMD variants on a CPU. It checks for AVX, but doesn't (IMHO) go far enough to actually be useful in some cases. It is possible to be on a CPU with AVX support and the OS doesn't support it. We should be checking that such support exists. This is via an additional check of cpuinfo's ECX register bit 27. Then one needs to call xgetbv and if EAX&0b110 = 0b110 then AVX is supported by the CPU and OS.

Attached is a patch to ax_ext.m4 and a new support file ax_gcc_x86_avx_xgetbv.m4

Michael Petch <mdpetch>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

Attached Files
file #28488:  0001-AVX-fixes.patch added by mdpetch (9KiB - application/octet-stream - Complete patch against latest git)
file #28399:  ax_ext.m4.patch2 added by mdpetch (6KiB - application/octet-stream - Preferred patch that prevents xgetbv from being executed if on an non-AVX supported CPU)
file #28365:  ax_ext.patch added by mdpetch (2KiB - application/octet-stream)
file #28366:  ax_gcc_x86_avx_xgetbv.m4 added by mdpetch (3KiB - application/octet-stream)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by ctournayre (Posted a comment)
  • -email is unavailable- added by simons (Posted a comment)
  • -email is unavailable- added by simons
  • -email is unavailable- added by mdpetch (Submitted the item)

    Follow 10 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2013-07-10 simons StatusReady For Test Done
        Open/ClosedOpen Closed
    2013-07-06 simons StatusIn Progress Ready For Test
    2013-07-05 mdpetch Attached File- Added 0001-AVX-fixes.patch, #28488
    2013-06-24 mdpetch Attached File- Added ax_ext.m4.patch2, #28399
    2013-06-20 simons Assigned toNone simons
        Carbon-Copy- Added christophe tournayre <>
    2013-06-20 simons StatusNone In Progress
    2013-06-20 mdpetch Attached File- Added ax_ext.patch, #28365
        Attached File- Added ax_gcc_x86_avx_xgetbv.m4, #28366

    Back to the top

    Powered by Savane 3.12.
    Corresponding source code