[DragonFlyBSD - Submit #2456] AVX Instruction Set Support

Alex Hornung via Redmine bugtracker-admin at leaf.dragonflybsd.org
Thu Nov 15 06:29:40 PST 2012


Issue #2456 has been updated by Alex Hornung.


FWIW, we use direct bytecodes elsewhere as well instead of relying on the compiler or assembler understanding the mnemonic. There's nothing wrong with that as long as there's a comment saying which instruction it is.

You may want to consider using the direct bytecodes and enabling the option by default, simply using a feature check to switch between the different methods. That way there'd be no need to change the setting whenever X compiler becomes default, and people that already use a different compiler for some user programs can take advantage of AVX *now*.

In any case, thanks for the good work!

HTH,
Alex
----------------------------------------
Submit #2456: AVX Instruction Set Support
http://bugs.dragonflybsd.org/issues/2456

Author: Adam Sakareassen
Status: New
Priority: Normal
Assignee: 
Category: 
Target version: 


This patch enables operating system support for the AVX instruction set for the 64-bit version of Dragonfly BSD.  AVX includes new CPU registers.  These registers need to be saved and restored during a context switch.  This patch should also support the future AVX2 instruction set.

Specifically:

1.  A new configuration option is added.  CPU_ENABLE_AVX.  It is disabled by default.  When it is disabled this patch will have practically no effect.  
2. When you enable this option you will need to compile with gcc4.7 or later.
3. The CPU will be checked for XSAVE and AVX support on boot.  If both are found they will be enabled.  
4.  If enabled, the FPU registers including the new 256-bit YMM registers will be saved using the new XSAVE function.  (Otherwise it will revert to the former the former FPU code). 


Issues:
1. The kernel does not check the CPU for the size of the XSAVE structure.  I didn't attempt to do this because I didn't want to mess too much with the existing FPU code.  This only has an effect if someone wishes to add support for new CPU features that use the XSAVE interface.  They will need to manually allocate space for this structure.  I checked the FreeBSD AVX patch and it does the same thing.

2.  Compilation is restricted to gcc4.7 or later.  (Actually 4.6 probably works but I haven't checked as its not part of our system).  The FreeBSD patch directly includes machine code to support older compilers.  I thought it more elegant to use readable assembler.  Besides, if users don't have a new compiler, they can't compile AVX support for their programs.  The kernel still compiles fine on gcc4.4 with the configuration option disabled.  I suggest that AVX support become the default when gcc4.7 becomes Dragonfly's default compiler.


-- 
You have received this notification because you have either subscribed to it, or are involved in it.
To change your notification preferences, please click here: http://bugs.dragonflybsd.org/my/account



More information about the Submit mailing list