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

Submitted by:  Michael Petch <mdpetch>
Submitted on:  Thu Jun 20 20:37:24 2013  
Priority: 5 - NormalStatus: Done
Assigned to: Peter Simons <simons>Open/Closed: Closed

Add a New Comment (Rich MarkupRich Markup):

You are not logged in

Please log in, so followups can be emailed to you.


(Jump to the original submission Jump to the original submission)

Sat Jul 6 09:36:06 2013, comment #8:

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

Peter Simons <simons>
Project AdministratorIn charge of this item.
Fri Jul 5 14:25:46 2013, 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 Jul 5 11:26:29 2013, 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>
Project AdministratorIn charge of this item.
Mon Jun 24 16:55:48 2013, 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 Jun 24 16:52:53 2013, 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 Jun 21 13:26:38 2013, 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 Jun 20 21:47:35 2013, comment #2:

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

Peter Simons <simons>
Project AdministratorIn charge of this item.
Thu Jun 20 20:38:56 2013, comment #1:

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

Michael Petch <mdpetch>
Thu Jun 20 20:37:24 2013, 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 File(s):

Attached Files
file #28488:  0001-AVX-fixes.patch added by mdpetch (9kB - application/octet-stream - Complete patch against latest git)
file #28399:  ax_ext.m4.patch2 added by mdpetch (6kB - 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 (2kB - application/octet-stream)
file #28366:  ax_gcc_x86_avx_xgetbv.m4 added by mdpetch (3kB - application/octet-stream)


Depends on the following items: None found

Items that depend on this one: None found


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

    Please enter the title of George Orwell's famous dystopian book (it's a date):



    Follow 10 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed Jul 10 07:59:21 2013simonsStatusReady For Test=>Done
    Sat Jul 6 09:36:06 2013simonsStatusIn Progress=>Ready For Test
    Fri Jul 5 14:25:46 2013mdpetchAttached File-=>Added 0001-AVX-fixes.patch, #28488
    Mon Jun 24 16:52:53 2013mdpetchAttached File-=>Added ax_ext.m4.patch2, #28399
    Thu Jun 20 21:47:35 2013simonsAssigned toNone=>simons
      Carbon-Copy-=>Added christophe tournayre
    Thu Jun 20 21:47:34 2013simonsStatusNone=>In Progress
    Thu Jun 20 20:37:24 2013mdpetchAttached File-=>Added ax_ext.patch, #28365
      Attached File-=>Added ax_gcc_x86_avx_xgetbv.m4, #28366

    Back to the top

    Powered by Savane 3.1-cleanup