updating the compiler? · 2 toolchain module for suse linux enterprise 12 • yearly release •...

31
Updating the Compiler? Take Advantage of The New Development Toolchain Andreas Jaeger Product Manager [email protected]

Upload: others

Post on 04-Aug-2020

27 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Updating the Compiler? · 2 Toolchain Module for SUSE Linux Enterprise 12 • Yearly release • Deliver new Compiler and toolchain ‒ GCC (“GNU Compiler Collection) development

Updating the Compiler?Take Advantage of The New Development Toolchain

Andreas JaegerProduct Manager

[email protected]

Page 2: Updating the Compiler? · 2 Toolchain Module for SUSE Linux Enterprise 12 • Yearly release • Deliver new Compiler and toolchain ‒ GCC (“GNU Compiler Collection) development

2

Toolchain Module for SUSE Linux Enterprise 12

• Yearly release

• Deliver new Compiler and toolchain‒ GCC (“GNU Compiler Collection) development tools via

Toolchain Module

‒ GCC runtime libraries, binutils, gdb as updates for SLE Core

• Versions for 2015 update of Toolchain Module for SUSE Linux Enterprise 12:

‒ GCC 5.2 with C, C++, Fortran support

‒ Binutils 2.25

‒ Gdb 7.9

• Package build compiler (GCC 4.8) stays as default

• New module is supported (latest version of SW)

Page 3: Updating the Compiler? · 2 Toolchain Module for SUSE Linux Enterprise 12 • Yearly release • Deliver new Compiler and toolchain ‒ GCC (“GNU Compiler Collection) development

3

Compare with SUSE Linux Enterprise 11

• Update of toolchain with each Service Pack

• Deliver GCC new development tool via SDK

• Deliver GCC runtime libraries, binutils, gdb as part of SLE core

• No support for newer GCC

Page 4: Updating the Compiler? · 2 Toolchain Module for SUSE Linux Enterprise 12 • Yearly release • Deliver new Compiler and toolchain ‒ GCC (“GNU Compiler Collection) development

4

How to use new tools?

• Binutils, gdb: No change

• GCC: Use “XXX-5” instead of “XXX”, for example:‒‒

Page 5: Updating the Compiler? · 2 Toolchain Module for SUSE Linux Enterprise 12 • Yearly release • Deliver new Compiler and toolchain ‒ GCC (“GNU Compiler Collection) development

5

Note: GCC versioning scheme

• Previously (until GCC 4.9):‒ Major release every year: 4.0, 4.1,...

‒ First release: 4.8.0

‒ Minor releases: 4.8.1, 4.8.2

• Now:‒ Major release every year: 5, 6, 7

‒ First release: 5.1

‒ Minor release: 5.2, 5.3

Page 6: Updating the Compiler? · 2 Toolchain Module for SUSE Linux Enterprise 12 • Yearly release • Deliver new Compiler and toolchain ‒ GCC (“GNU Compiler Collection) development

Advantages of new toolchain

Page 7: Updating the Compiler? · 2 Toolchain Module for SUSE Linux Enterprise 12 • Yearly release • Deliver new Compiler and toolchain ‒ GCC (“GNU Compiler Collection) development

7

Why new compiler?

• Compiler optimizations

• Support for CPUs

• New language features

• Diagnostics and debugging

Page 8: Updating the Compiler? · 2 Toolchain Module for SUSE Linux Enterprise 12 • Yearly release • Deliver new Compiler and toolchain ‒ GCC (“GNU Compiler Collection) development

8

Compiler optimizations in GCC 5

• Link Time Optimization

• Interprocedural Optimization

• Thread improvements:‒ OpenMP 4.0

‒ Cilk Plus

‒ OpenACC 2.0

Page 9: Updating the Compiler? · 2 Toolchain Module for SUSE Linux Enterprise 12 • Yearly release • Deliver new Compiler and toolchain ‒ GCC (“GNU Compiler Collection) development

9

Support for newer CPUs

• X86-64:‒ AVX-512 support

‒ Intel MPX

‒ Intel Broadwell and Silvermont microarchitectures

‒ AMD family 15h processors (Excavator core)

• Power:‒ Power8 support

Page 10: Updating the Compiler? · 2 Toolchain Module for SUSE Linux Enterprise 12 • Yearly release • Deliver new Compiler and toolchain ‒ GCC (“GNU Compiler Collection) development

10

New language features

• GNU C 11 is default (ISO C 11 plus GNU extensions)

• C++ 11 finished

• C++ 14 as experimental

• Cilk Plus support

Page 11: Updating the Compiler? · 2 Toolchain Module for SUSE Linux Enterprise 12 • Yearly release • Deliver new Compiler and toolchain ‒ GCC (“GNU Compiler Collection) development

11

New libstdc++

• Libstdc++ contains Dual ABI:‒ New ABI is C++11 conforming

‒ Old ABI for compatibility with previous compilers

‒ C++11 conforming std::list with O(1) size() function

‒ std::string uses small string optimization instead of copy-on-write reference counting

‒ SUSE Linux Enterprise Server 12 uses Old ABI by default, since system libraries are compiled using the Old ABI

Page 12: Updating the Compiler? · 2 Toolchain Module for SUSE Linux Enterprise 12 • Yearly release • Deliver new Compiler and toolchain ‒ GCC (“GNU Compiler Collection) development

12

Diagnostics and debuggingRuntime checks using sanitizer

• -fsanitize=address: Memory error detector like out-of-bounds and use-after-free bugs.

• -fsanitze=thread

• UndefinedBehaviorSanitizer (-fsanitize=undefined) enhanced:

‒ shift

‒ integer-divide-by-zero

‒ bound

Page 13: Updating the Compiler? · 2 Toolchain Module for SUSE Linux Enterprise 12 • Yearly release • Deliver new Compiler and toolchain ‒ GCC (“GNU Compiler Collection) development

13

Diagnostics and debuggingColorizing of messages

Page 14: Updating the Compiler? · 2 Toolchain Module for SUSE Linux Enterprise 12 • Yearly release • Deliver new Compiler and toolchain ‒ GCC (“GNU Compiler Collection) development

14

Optimization Tips

• To optimize for current machine: -march=native

• To optimize for pool of machines: Use -march=X and select lowest common dominator or don't set it at all

• Optimization flags: ‒ -O2

‒ -O3,

‒ -Ofast: includes -O3, -ffast-math, “unsafe” optimizations

• Speed optimizations:

1) Use FTO

2) Use FTO+LTO

Page 15: Updating the Compiler? · 2 Toolchain Module for SUSE Linux Enterprise 12 • Yearly release • Deliver new Compiler and toolchain ‒ GCC (“GNU Compiler Collection) development

15

Feedback Driven Optimization

• Use information about common paths from run-time to optimize the common case, including value profiling

• Usage:‒ Build binary for profiling:

$ gcc -Ofast program.c -o program -fprofile-generate

‒ Execute binary and create profile data

‒ Recompile binary using profile:$ gcc -Ofast program.c -o program -fprofile-use=program.gcda

• Note: Profiling collection not thread-safe

Page 16: Updating the Compiler? · 2 Toolchain Module for SUSE Linux Enterprise 12 • Yearly release • Deliver new Compiler and toolchain ‒ GCC (“GNU Compiler Collection) development

16

Link Time Optimization

• Whole-program optimization instead of single source file optimization

• Files get “compiled” into .o: streaming presentation of internal data

• Optimization happens at link time for the whole program

• Allows interprocedural analysis across files

Page 17: Updating the Compiler? · 2 Toolchain Module for SUSE Linux Enterprise 12 • Yearly release • Deliver new Compiler and toolchain ‒ GCC (“GNU Compiler Collection) development

17

Link Time Optimization: Usage

• Build binaries using:$ gcc -Ofast -flto -c file1.c$ gcc -Ofast -flto -c file2.c

• Link using:$ gcc -flto -o program file1.o file2.o

Page 18: Updating the Compiler? · 2 Toolchain Module for SUSE Linux Enterprise 12 • Yearly release • Deliver new Compiler and toolchain ‒ GCC (“GNU Compiler Collection) development

18

Link Time Optimization: New in GCC 5

• Slim object files

• One definition rule: Aliasing and devirtualization optimizations

‒ -Wodr – warn about violation of one definition rule

• Compile time options will be preserved for link time‒ function granularity

‒ Allows special compiler flags for individual files

Page 19: Updating the Compiler? · 2 Toolchain Module for SUSE Linux Enterprise 12 • Yearly release • Deliver new Compiler and toolchain ‒ GCC (“GNU Compiler Collection) development

19

Interprocedural Optimizations

• Work best on LTO

• New identical code folding pass

• Improved devirtualization pass

• New comdat localization pass: allows the linker to eliminate more dead code in presence of C++ inline functions.

• Optimized virtual tables

• Elimination of write-only variables

Page 20: Updating the Compiler? · 2 Toolchain Module for SUSE Linux Enterprise 12 • Yearly release • Deliver new Compiler and toolchain ‒ GCC (“GNU Compiler Collection) development

20

Outlook GCC 6

• Note: GCC 6 will come out in Q2 2016 and is under development

• C++14 as default;

• First C++17 experimental features

• GPU offloading “usable”

• LTO debugging

Page 21: Updating the Compiler? · 2 Toolchain Module for SUSE Linux Enterprise 12 • Yearly release • Deliver new Compiler and toolchain ‒ GCC (“GNU Compiler Collection) development

21

Why new toolchain?

• GDB:‒ Understand new debug information by compiler

• Binutils:‒ Support for new toolchain

‒ Support for new CPUs

Page 22: Updating the Compiler? · 2 Toolchain Module for SUSE Linux Enterprise 12 • Yearly release • Deliver new Compiler and toolchain ‒ GCC (“GNU Compiler Collection) development

22

GDB 7.9 and Binutils 2.25

• GDB 7.9:‒ Improved python scripting API

‒ Thread signal handling improved

‒ Bug fixes

• Binutils:‒ Minor new commands like “strings –data” or “strings –include-

all-whitespace”

‒ Bug fixes

Page 23: Updating the Compiler? · 2 Toolchain Module for SUSE Linux Enterprise 12 • Yearly release • Deliver new Compiler and toolchain ‒ GCC (“GNU Compiler Collection) development

23

Distributing Self-Compiled Software

• Software build with new Toolchain Module will run on updated SLE 12 systems

‒ Need updates for runtime libraries installed

Page 24: Updating the Compiler? · 2 Toolchain Module for SUSE Linux Enterprise 12 • Yearly release • Deliver new Compiler and toolchain ‒ GCC (“GNU Compiler Collection) development

24

Support

• Support via the usual channel

• Our GCC team needs self-contained code to reproduce issues

• Concentrate on -g/-g0, -O[0123], -ffast-math, -Ofast

Page 25: Updating the Compiler? · 2 Toolchain Module for SUSE Linux Enterprise 12 • Yearly release • Deliver new Compiler and toolchain ‒ GCC (“GNU Compiler Collection) development

Installation

Page 26: Updating the Compiler? · 2 Toolchain Module for SUSE Linux Enterprise 12 • Yearly release • Deliver new Compiler and toolchain ‒ GCC (“GNU Compiler Collection) development

26

Modules - Overview

Module Name Content (examples) Lifecycle

Advanced Systems Management Module

The configuration management tools cfengine, puppet, salt and the new "machinery" tool

Continuous Integration

Container Module Docker and container related functionality such as ECS integration

Continuous Integration

Legacy Module Sendmail, old IMAP stack, old Java etc.

3 years

Public Cloud Module Instance initialization code, command line tools for management

Continuous Integration

Toolchain Module GCC Yearly delivery

Web and Scripting Module

“PHP”, “Python” 3 years, 18 months overlap

Module Name Content (examples) Lifecycle

Advanced Systems Management Module

The configuration management tools cfengine, puppet, salt and the new "machinery" tool

Continuous Integration

Container Module Docker and container related functionality such as ECS integration

Continuous Integration

Legacy Module Sendmail, old IMAP stack, old Java etc.

3 years

Public Cloud Module Instance initialization code, command line tools for management

Continuous Integration

Toolchain Module GCC Yearly delivery

Web and Scripting Module

“PHP”, “Python” 3 years, 18 months overlap

Page 27: Updating the Compiler? · 2 Toolchain Module for SUSE Linux Enterprise 12 • Yearly release • Deliver new Compiler and toolchain ‒ GCC (“GNU Compiler Collection) development

27

Module – Software Install

Page 28: Updating the Compiler? · 2 Toolchain Module for SUSE Linux Enterprise 12 • Yearly release • Deliver new Compiler and toolchain ‒ GCC (“GNU Compiler Collection) development

Thank you.

28

How will you use our new toolchain?

Page 29: Updating the Compiler? · 2 Toolchain Module for SUSE Linux Enterprise 12 • Yearly release • Deliver new Compiler and toolchain ‒ GCC (“GNU Compiler Collection) development

29

Page 30: Updating the Compiler? · 2 Toolchain Module for SUSE Linux Enterprise 12 • Yearly release • Deliver new Compiler and toolchain ‒ GCC (“GNU Compiler Collection) development

Corporate HeadquartersMaxfeldstrasse 590409 NurembergGermany

+49 911 740 53 0 (Worldwide)www.suse.com

Join us on:www.opensuse.org

30

Page 31: Updating the Compiler? · 2 Toolchain Module for SUSE Linux Enterprise 12 • Yearly release • Deliver new Compiler and toolchain ‒ GCC (“GNU Compiler Collection) development

Unpublished Work of SUSE LLC. All Rights Reserved.This work is an unpublished work and contains confidential, proprietary and trade secret information of SUSE LLC. Access to this work is restricted to SUSE employees who have a need to know to perform tasks within the scope of their assignments. No part of this work may be practiced, performed, copied, distributed, revised, modified, translated, abridged, condensed, expanded, collected, or adapted without the prior written consent of SUSE. Any use or exploitation of this work without authorization could subject the perpetrator to criminal and civil liability.

General DisclaimerThis document is not to be construed as a promise by any participating company to develop, deliver, or market a product. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. SUSE makes no representations or warranties with respect to the contents of this document, and specifically disclaims any express or implied warranties of merchantability or fitness for any particular purpose. The development, release, and timing of features or functionality described for SUSE products remains at the sole discretion of SUSE. Further, SUSE reserves the right to revise this document and to make changes to its content, at any time, without obligation to notify any person or entity of such revisions or changes. All SUSE marks referenced in this presentation are trademarks or registered trademarks of Novell, Inc. in the United States and other countries. All third-party trademarks are the property of their respective owners.