All my CPU does is overheat, travel to other dimensions, take really really really long vacations, sleeps a lot, and seriously believes that playing solitaire requires 100% CPU power...
@tititwist465 жыл бұрын
its predicting every possible future where you dont win the game and trying to find a future where you do. its still looking
@vintyprod5 жыл бұрын
its making friends with some Trojans
@PASTRAMIKick4 жыл бұрын
I just realised you're the guy who made the Godbolt Compiler Explorer, it's a great tool you have my thanks for it.
@MattGodbolt4 жыл бұрын
Thanks :)
@Xiefux5 жыл бұрын
i always thought the cpu was just a rock with lightning in it
@emiliancioca6 жыл бұрын
Short and sweet video :) You caught me with SSA. Never heard about it before. I would have assumed this kind of optimization would still remain the responsibility of the compiler. However, it seems like this can be a way to increase the number of effective registers without having to update the x86 standard (or having to recompile and re-distribute executables). Super cool!
@MattGodbolt6 жыл бұрын
Absolutely. In the processor the technique is called "Register Renaming". Some CPUs of course have a load more registers, but there's a trade-off between the encoding of the instructions which refer to those registers, and the utility of having explicit control over which registers are used. Register renaming is a cute trick to make more use with fewer architectural registers.
@Diamonddavej5 жыл бұрын
A CPU generates a similar heat flux as a nuclear reactor fuel rod (100 Watts/cm2 v's125 Watts/cm2).
@dikhim5 жыл бұрын
Not so much as a lightbulb :)
@Diamonddavej5 жыл бұрын
@@dikhim I wonder... www.physicsforums.com/threads/surface-area-of-a-bulb-filament.721597/
@rssven18275 жыл бұрын
3.5 roentgen not good but not too bad either
@swimfan3135 жыл бұрын
Does this not create a vulnerability in the process by where you could inspect the speculated branches and then by process of elimination get an estimation of the branch that succeeded?
@Revoker12212 жыл бұрын
I'm a couple of years late, but to answer your question and anyone else wondering the same thing: Yes, yes it does create a pretty significant vulnerability. The vulnerability was called something like "Spectre", there were a number of different flavours of it, and while some of the vulnerability could be patched on the software side of things, there were some flavours that would require a hardware fix. For more info, this CppCon talk should be quite illuminating: kzbin.info/www/bejne/lZeagGZ_m66FaM0 Interestingly enough, the person giving the presentation gave a presentation the previous year about speculative branching, so if you want to learn more about that with some better visualisations and explanations, check out his talk from the year earlier.
@Das_Unterstrich5 жыл бұрын
My CPU doesn't allows me to open 2 chrome tabs at once.
@abdullahamrsobh3 жыл бұрын
Actually that would be problem with your ram
@foxl91952 жыл бұрын
3:10 What if both rsi and rdi point to the same memory address? How does CPU handle this case?
@MattGodbolt2 жыл бұрын
Great question! There is a considerable amount of magic here - there's load and store queues which can forward the data (if ready), and if not there are hazard detectors that notice when the data being read by a later instruction was actually modified; and then the load needs to be re-run.
@foxl91952 жыл бұрын
Awesome. Thanks, Matt!
@Spike81194 жыл бұрын
Rip spectre and meltdown abusing these fun concepts
@iconjack2 жыл бұрын
4:14 What if rsi == rdi?
@MattGodbolt2 жыл бұрын
I replied in a comment below (by Fox L) - short version is there's magic (load/store forwarding and various tracking) that will restart the instructions if it's found to alias afterwards. www.agner.org/optimize/microarchitecture.pdf has lots of info on this (look for "store forwarding" and "memory intermediates in depedendency chains"). I also heartily recommend www.amazon.com/Modern-Processor-Design-Fundamentals-Superscalar/dp/1478607831 if you like this kind of stuff!
@conflagrationTuesday5 жыл бұрын
GREAT video! You say 'parallel' quite a lot.. Do you mean literally simultaneously on another CPU thread/core?
@MattGodbolt5 жыл бұрын
Literally simultaneously. Modern CPUs can be running many tens of instructions at once on a single thread on a single core
@billthemanofgoodnis6 жыл бұрын
Nice video!
@deckard5pegasus673 Жыл бұрын
And just imagine all the extra complication, just because the CPU is faster than RAM access. If someone could speed up RAM access times... The most interesting imo, is the CPU RISC microcode. In the end RISC won, ARM and Apple M1 are more popular due to phones than Intel/AMD. And the icing on the cake is Intel/AMD are also RISC. x86 is on life support, and I guess probably only kept alive by the ancient Win-Tel Pact (more bloated OS needs faster CPU Pentium XXX-Ultra-power...requiring a new computer ever 2 years consumer scam) and the fact that even modern windows is still running NT/Win32 at it's core. "It was then that I learned that computers were built to make money, not minds." - Gary Kildall (Pioneering Lengend).
@cdriper Жыл бұрын
I already know all 5 points. Where can I obtain my gold medal? )
@MattGodbolt Жыл бұрын
Here: *medal* :D
@thompsonevergreen80065 жыл бұрын
My Intel cpu, it got my back, my Intel cpu, it do me proud, my Intel cpu, it be my bro, my Intel cpu it never let me down
@GodofAshes5 жыл бұрын
Except for Meltdown, Spectre and Zombieload, collectively responsible for slowing your CPU down by up to 30% (or your OS by 75%, if you're on MacOS) - These are things that make me wish I hadn't bought that i7, and instead bought an AMD Ryzen CPU.
@thompsonevergreen80065 жыл бұрын
@@GodofAshes no one likes you
@GodofAshes5 жыл бұрын
@@thompsonevergreen8006 Thank you, that means a lot to me :')
@elgoog-the-third5 жыл бұрын
Your Intel CPU, it's overpriced, your Intel CPU, it heats your house, your Intel CPU, it's full of bugs
@Motscoud5 жыл бұрын
My intel cpu, it leaks my data, my intel cpu, it's got more holes than swiss cheese, my intel cpu, it heats up my room, my intel cpu, it's performance drops daily
@kriskeersmaekers2335 жыл бұрын
With 1. You're actually wrong about that, it will already hit on the second cache as it already pulls a bunch of neighboring memory for exactly this reason
@MattGodbolt5 жыл бұрын
Which part specifically are you referring to? Cache misses of course pull in neighbouring memory: the whole cache line. However the caches also use patterns in cache misses to pre-emptively start fetching. I have a much longer talk that goes into this in a little more detail, and you can read a lot more about it if you Google for Ulrich Drepper's "What every programmer should know about memory" paper
@Xtcent5 жыл бұрын
I wonder what i am going to do with this information. smh