Ryzen

From Gentoo Wiki
Jump to: navigation, search
Resources

Ryzen is a multithreaded, high performance processor released by AMD in Q1, 2017. It is the first CPU released based on the Zen microarchitecture. Its goal is to directly compete with Intel's Broadwell-E processor line, primarily the Core i7-6900K.

Hardware

Ryzen 7

Device Make/model Status Bus ID Kernel driver(s) Kernel version Latest microcode Notes
AMD Ryzen 7 1800X AMD Works N/A N/A 4.4.10+  ?  ?
AMD Ryzen 7 1700X AMD Works N/A N/A 4.4.10+ 0x08001126  ?
AMD Ryzen 7 1700 AMD Works N/A N/A 4.4.10+ 0x800111c  ?

Ryzen 5

Device Make/model Status Bus ID Kernel driver(s) Kernel version Latest microcode Notes
AMD Ryzen 5 1600X AMD Works N/A N/A  ?  ?  ?
AMD Ryzen 5 1600 AMD Works N/A N/A 4.4.10+ 0x08001126  ?
AMD Ryzen 5 1500X AMD Works N/A N/A  ?  ?  ?
AMD Ryzen 5 1400 AMD Works N/A N/A  ?  ?  ?

Installation

Firmware

Microcode/firmware updates to be determined...

Kernel

Enable support for Ryzen hardware in kernel 4.11.0:

KERNEL Kernel 4.11.0
Processor type and features  --->
  [*] Symmetric multi-processing support
  [*] AMD ACPI2Platform devices support
  Processor family (Opteron/Athlon64/Hammer/K8)  --->
    (X) Opteron/Athlon64/Hammer/K8
  [*] Supported processor vendors  --->
    [*]   Support AMD processors (NEW)
  [*] SMT (Hyperthreading) scheduler support
  [*] Multi-core scheduler support
  [*] Machine Check / overheating reporting
  [*]   AMD MCE features
  Performance monitoring  --->
    <*> AMD Processor Power Reporting Mechanism
  [*]   AMD microcode loading support
Power management and ACPI options  --->
  CPU Frequency scaling  --->
    <*>   AMD Opteron/Athlon64 PowerNow!
    <*>   AMD frequency sensitivity feedback powersave bias
Device Drivers  --->
  [*] IOMMU Hardware Support  --->
    [*]   AMD IOMMU support
    <*>     AMD IOMMU Version 2 driver

Those using sys-kernel/gentoo-sources with the experimental USE flag will have additional Processor family options made available:

KERNEL Kernel 4.11.0 (gentoo-sources)
Processor type and features  --->
  Processor family (MZEN)  --->
    (X) AMD Zen

This enables -march=znver1 to be set for the kernel's make process.

Tip
Alternatively, Generic-x86-64 can be set in the Processor family for more generic CPU support. In theory this would make the kernel binaries portable in the event that it would be use on CPUs other than AMD Ryzen.

Configuration

GCC

GCC 6.3+

GCC 6.3+ has support for the znver1 compiler optimization. For optimal performance, this can be enabled in make.conf.

FILE /etc/portage/make.confZen compiler optimization
CFLAGS="-O2 -march=znver1"

GCC 6.3 is not presently optimized for Ryzen. [1]

GCC 5.4

While GCC 5.4 does not support zen core specific optimization, -march=bdver4 has been shown to be functional and stable. However, since Zen dropped the instruction set extensions FMA4, TBM, XOP and LWP, they should be disabled accordingly:

FILE /etc/portage/make.confZen compiler optimization for GCC 5.4 and lower
CFLAGS="-O2 -march=bdver4 -mno-fma4 -mno-tbm -mno-xop -mno-lwp"
Important
Previously -march=haswell was said to be functional with Zen[2], but a Gentoo developer experienced various SEGVs with this option.
Important
The use of bare -march=bdver4 was said to be functional without issues, nevertheless it may still produce faulty code due to the lack of before mentioned instruction set extensions. Bulldozer has them, Zen does not.

Optional, but may produce better code: Add new instruction set extensions introduced with Zen individually (ADCX, RDSEED, MWAITX, SHA, CLZERO, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT), using -march=bdver4 (Bulldozer Version 4 i.e. Excavator) as the starting point:

FILE /etc/portage/make.confEXPERIMENTAL compiler optimization for GCC 5.4 specifying new extensions for Zen
CFLAGS="-O2 -march=bdver4 -mno-fma4 -mno-tbm -mno-xop -mno-lwp -mclzero -madx -mrdseed -mmwaitx -msha -mxsavec -mxsaves -mclflushopt -mpopcnt"

Troubleshooting

Segmentation faults during compilation

If segfaults are encountered during compilation process on Zen it might be anything from software bug to a hardware bug. There have been reports of success and failure. The recommendation is to disable all overclocking and set proper timings for RAM. These problems are likely to be fixed in the future by AMD microcode update and/or GCC update.

Note
As of 2017-08-08 it seems like the problem may reside inside the Ryzen processor. This problem should only affect the very few early Ryzen patches that were produced. AMD is currently aware of the issue[3].

Please ensure the most recently compiled binutils is selected via

user $eselect binutils list
 [1] x86_64-pc-linux-gnu-2.27
 [2] x86_64-pc-linux-gnu-2.28 *
  • An older instance of binutils could be built against older opcode facilitating crashes due to poor linkage.
  • Ensure RAM voltage and timing are correct for the RAM; BIOSs are conservative while performing autosetting.
  • Consider downgrading BIOS to the most stable. ASUS and ASRock have been known to push very beta BIOSs that have shown to be very unstable.
  • Some motherboards' BIOS have an option to disable OPCache. This has been observed to limit or stop segfaults albeit with a 5-7% performance cost.

Related forum topics: 1 and 2. And a Phoronix forum topic.

Ryzen users can also fill Gentoo and Ryzen config and stability questionnaire to help out collecting data. See also the datasheet generated from above questionnaire.

See also

  • AMDGPU — the next generation family of open source graphics drivers for newer AMD/ATI Radeon graphics cards based on the Southern Islands, Sea Islands, Volcanic Islands, and Arctic Islands chipsets.
  • AMDGPU-PRO — the next generation closed source graphics component that operates on top of the open source AMDGPU drivers for newer AMD/ATI Radeon graphics cards.
  • AMD microcode — describes updating the microcode for AMD processors.

External resources

References