Note: this isn't a bug in gcc, but looks like hardware bug related to hyperthreading.
Note: this isn't a bug in gcc, but looks like hardware bug related to hyperthreading.
One of the good OCaml folks over at Jane Street just recently found a bug that crashes systems with Hyperthreading enabled on both Intel Skylake and Kaby Lake as well – just saying:
https://news.ycombinator.com/item?id=14630183
Those hardware bugs are all very disheartening from software folks perspective, doesn't matter which company it pertains... "microcode update" rollseyes
Edit: dear AMD haters, keep the downvotes coming B-) it has only been since May that the first fixes have been rolled out for Skylake / Kaby Lake – and yes, naturally AMD should "fix" (rollseyesagain) their respective issues ASAP but just saying...
https://arstechnica.com/information-technology/2017/06/skyla...
Edit: thanks, s/unacknowledged/being investigated/
I just wanted to say that many recent CPUs seem to be rushed efforts - be it Intel or AMD.
http://www.anandtech.com/show/11544/intel-skylake-ep-vs-amd-...
From what I've seen, performance is only hurt in contrived benchmarks intended to cause slowdowns when HT is in use.
Hyperthreading makes better use of execution units but causes twice as many threads to share memory bandwidth and caches. It's often a good trade-off.
But it's also less valuable for high core-count processors, because workloads that aren't highly parallel will have idle real cores to run other threads on, and highly parallel workloads are more likely to be bottlenecked by memory and caches when there are more cores.
The real question is whether it's faster for your workload. And your hardware. The answer could be different on a system with 8 cores and 2 memory channels than a system with 4 cores and 4 memory channels.
Turn it on and then off and see which is faster for you.
See also: https://wiki.debian.org/llvm-clang
We just switched openSUSE Tumbleweed to GCC7 a few months ago, and it was a very large amount of work. I can't imagine how much work it would take to switch to LLVM.
Is it work? Sure. But it's not like "years of real work". It's about 5-10 people for a quarter or two.
And the Linux kernel, due to its heavy use of gcc-specific extensions, also has some problems compiling with LLVM; see https://bugs.llvm.org/show_bug.cgi?id=4068 for a list.
At this time that effort is dead: the few ports that don't build with clang are accepted as doing something that will never work.
GCC has these.
In practice, most supporting of the kernel has come about by clang implementing things how gcc do them anyway.
It leads to lock-ins, like the current kernel is locked into GCC. Some of those GCC Extensions used are effectively proprietary because "the code is the documentation" so nobody can replicate it for their own compiler.
I do not believe that is healthy.
But only supporting one compiler has the advantage that you're aren't limited to the lowest common denominator of compiler features.
You'll notice this especially with C++ codebases which try to support GCC, Clang, Intel and Visual C++. You'll need a lot of macros and workarounds for each compiler's quirks.
C can be a hard to wrangle beast and the more checks I have on my code quality the better I sleep at night.
* Compiling SPIR-V shaders to GPU executables
* Compiling C
* Compiling C++
* Compiling Rust
* Compiling Haskell
* Compiling Swift
* JIT compilers for databases
* JVM JIT
Effectively once you translate to LLVM-IR you are basically home free, the LLVM can handle the rest. Which means you have a board range of people providing optimization passes, and catching bugs.
---
With the GCC its IR is tightly coupled to the C front end. While there has been some decoupling, this is generally considered a feature as it doesn't allow for a corporation to _run away_ with part of the project.
---
The LLVM is more modular, you can pick and take what you need. You can embed it, or call it externally. It is a hybrid BST/MIT/X11 license so it is open source, and embedding it in your project doesn't mean your project becomes GPL'd.
That isn't to say there are not technical reasons to say llvm is better - there are good ones. However they are not compelling like the license is. Llvm has a better internal design which should be better long term, but so far gcc generally compiles faster code which is for most people more important that internal design.
Note that linux distributions are mostly built by the types of people who like the GPL3 license. Using gcc is the correct decision for most linux distributions.
As far as I know the GPL doesn't "infect" the program compiled with a GPL-licensed compiler, I can have my proprietary binary-only software compiled with the GPLed gcc just fine...
Indeed they do.
$ cc --version
gcc (GCC) 4.2.1 20070719
This system is stuck with a rather old branch of GCC. It won't ever be upgraded, because of the license. LLVM seems to be on its way though.It's also a factor if you're distributing a compiler with your operating system. This has already driven FreeBSD (IIRC) to LLVM, and OpenBSD is starting to adopt it for a few platforms (GCC is still required due to certain OpenBSD targets that aren't supported by LLVM, but if that's ever fixed - whether because OpenBSD drops those targets or because LLVM eventually supports them - then I'd be very surprised if a switch doesn't happen for all platforms).
Let them release their compiler for that language under GPLv3. What is there to be scared of?
*BSD has in generally hated having anything GPL in their base system. OpenBSD played with creating their own C compiler for a while (the goal was just a compiler with only minimal optimizations - they expected everyone would just use that to build gcc and then build everything with gcc)
Turns out that GCC is actually really fast for the quality of the code it generates, and Clang/LLVM take almost exactly the same amount of time to generate similar code.
They wanted the freedom to make the base system read only, and I get that, but if LLVM weren't there they would be shipping GPLv3 GCC and Emacs 25.
The tivoization clause has an explicit exception that allows for devices which can't be flashed. What the clause prohibits is the case when devices can only be flashed if you got the right developer password, and the publisher deny the owner of the device to have that password.
I wouldn't be surprised if the decision to go all-in on Clang was a reaction to a decade old grudge.
Why use Clang/LLVM with the Linux Kernel?
Fast Compiles (making you able to work faster)
LLVM/Clang is a fast moving project with many things fixed quickly and features added.
LLVM is a family of tools used in many problem domains leading to one code base being able to build tools to work on just about anything you need: one place to add features, or fix bugs.
BSD License (some people prefer this license to the GPL)
Built in static analyzer
Great error reporting and Fix-it hints
LLVM technology can be embedded into many tools (even yours!)
Already in wide used in OSS projects and in industry
I do remember talk on and off about shifting to the Intel c compiler, for increased performance - apparently Intel now has their own distro: