0:00: C++ performance based on compiler optimization 6:10: high level parts of compiler 9:10: LLVM's IR example, simple routine 10:22: LLVM's IR example, modelling data control flow 16:38: optimizer duties, cleanup 18:56: optimizer duties, canonicalization 22:26: optimizer duties, collapse abstractions 23:40: 3 key abstractions (function calls, memory, loops) 25:48: function calls abstraction, inlining 27:40: function calls abstraction, call graph 36:18: function calls abstraction, variadic functions 40:28: memory abstraction 44:20: memory abstraction (partitioning, isolating, other) 50:51: loop abstraction 54:30: loop abstraction, canonicalization 58:50: loop abstraction, loop unroll 1:04:00: loop abstraction, invariant control flow 1:09:00: loop abstraction, questions from audience 1:30:58: optimizing combined abstractions 1:35:30: const not optimized 1:37:52: conclusion and questions
@kadiyamsrikar95652 роки тому
Thanx :)
@diegonayalazo2 роки тому
Thanks!
@kamilziemian995Рік тому
Thank you.
@inthegaps3 роки тому
Kudos to whatever genius decided to put the dot pattern at the back of the stage, so that any camera motion is distracting at best, and nauseating at worst.
@MeetingCPP3 роки тому
Yes, I hate that wall so much :/
@jacobschmidt3 роки тому
I didn't notice until you pointed it out :/
@DatMilu2K7 років тому
When he asked the crowd if they are excited about C++ I was totally with him. :D
@ChristopherGray00Рік тому
How can you tell a C developer versus a C++ developer? The C++ developer is hyped for both, the C developer hates anything that is not C
@nickwilson1883Рік тому
@@ChristopherGray00 Usually c++ people complain about how bad C is all day and how you're a mongrel for not using C++
@nero5127 років тому
The first suggested video linked to this one is "Don't help the compiler" haha.
@ihatenumberinemail7 років тому
1:45:41 "once you have code that is clean on the sanitizers, then you know you have a compiler bug" "If we don't sanitize for it, we aren't going to optimize based on it" That guarantee makes me feel warm and fuzzy inside.
@KirillShvesov8 років тому
This cellular background makings me dizziness.
@wesofx81488 років тому
That wagon-wheel effect
@yemiez8 років тому
+Kirill Shvesov Yea
@nicholasfazzolari36478 років тому
Thanks for pointing it out. Now I'm dizzy :)
@malharjajoo62377 років тому
is making me dizzy*
@sorskilla4 роки тому
Holy shit! This.
@budiardjo66107 місяців тому
8 years later this person build carbon language
@BossGxngOfficial5 місяців тому
Bruh are you Indonesian?
@budiardjo66105 місяців тому
@@BossGxngOfficial sure
@BossGxngOfficial5 місяців тому
@@budiardjo6610 nyari teman dengan interested yang sama agak susah soalnya
@nathasion95563 роки тому
Chandler dude when someone asks you a question, please stop walking, and surely don't give him your back while walking. Also when there is a question in the public, please repeat the question so everyone knows what you are answering to....It is abc in public talking. Except that, brilliant lecture.
@MeetingCPP3 роки тому
I think he has learned that by now, video is from 2015.
@nathasion95563 роки тому
@@MeetingCPP haha well seen
@nnicolas176 років тому
The slides going out of sync made this really hard to follow.
@dkierans3 роки тому
I know this is five years old but looking through this comment section is a bit sad. It’s a pretty good talk.
@kamilziemian995Рік тому
What a fantastic talk.
@jean-francoiscaron57068 років тому
This is pretty hard to follow because the slide shown doesn't sync with the slide he's talking about. E.g. around 1:03:00 is pretty bad.
@jensw.61738 років тому
+Jean-Francois Caron Well, slides aren't recorded, so at some point it wasn't that easy to get it synced. But you can download the slides from Meeting C++.
@aaronr.96446 років тому
Very interesting talk. I am not familiar with fortran so I did not exactly follow what he said at 1:20:59 . As for sanitizers, yes ubsan is cool but it is runtime. This is the type of stuff I want to catch with static analysis.
@szirsp2 роки тому
20:40 Doesn't that discard potential branch prediction hint from the programmer who might know if it is going to be more likely for the 'if' condition to be true?
@OMARI-yp6dk7 років тому
thank you very much sir
@nguonbonnitРік тому
Wow ! So great. You help me a lots.
@juzujuzu45555 років тому
I have been wondering, what kind of information we could provide within our source code, for example through annotations, that could help the compiler to optimize better or to allow completely new optimizations? We could add new annotations as we find more useful information for compilers. What kind of information the developer knows of how his code should work that the compiler could use?
@darkengine59313 роки тому
The top priority that comes to mind for me is hot/cold splitting of both branches and especially data. We have a lot in the way of indicating hot/cold branching paths with most compilers although they tend to be compiler-specific, such as 'likely' and 'unlikely' in GCC, '__assume' in MSVC, and 'noinline' and 'forceinline' available in most compilers. The trickier part is hot/cold splitting of data (and it tends to make the bigger difference in most domains). Consider an example like this: struct Particle { // hot fields constantly accessed in critical loops __hot float x=0.0f, y=0.0f, z=0.0f, w=0.0f; // cold field only accessed in non-performance critical UI areas __cold uint32_t q = 0; }; Ideally in a such a scenario, storing a collection of particles such as in std::vector would not store all particle fields in a contiguous interleaved format like 'xyzwqxyzwqxyzwq', since 'q' would not be accessed in those critical loops. Loading it into a cache line would just be loading irrelevant data into it and wasting it. Instead it should store the data like: 'xyzwxyzwxyzw....' with an array for the cold field(s) like 'qqqqqq....' in parallel. Things of this nature, or even being able to store an SoA representation of such a structure without collapsing it into multiple structures.
@OmarChida2 роки тому
@@darkengine5931 thanks this was very helpful :)
@ChristopherGray00Рік тому
with o2 or o3 flag, the compiler isn't leaving out optimizations that you could otherwise specify with annotations, the idea is that it already does all of that for you, providing optimizations without the sacrifice of safety (as long as you are not using o3 then maybe)
@bobweiram63213 місяці тому
Ada's strict type system specifies intent, which hints possible optimizations to the compiler.
@alexanderwesterstahl8 років тому
Around 8 minutes in, the AST is mentioned, and dismissed as uninteresting for this subject. Isn't the AST a great place for optimizations?
@user-jq2tz6yw6p8 років тому
AST is Front End level representation of a program, it is a good place to do language specific optimizations. LLVM Intermediate Representation level has no language specific (although it inherits some notions like memory model from C/C++11) and this is good from compiler architecture level. Here you see Clang AST, but what if you want to create other than C-like programming language? In this case you will have to create another Front End which produces its own AST so to be able to benefit from generic optimizations and machine code generation (this is already implemented in LLVM) it may translate it to LLVM IR and voila, you have a complete working compiler for a huge variety of target machines from Intel, AMD, ARM, and so on.
@alexanderwesterstahl8 років тому
Пеш Любоп Thanks!
@Courserasrikanthdrk7 років тому
very descriptive :)
@diegonayalazo2 роки тому
Thanks
@SamualN8 місяців тому
1:35 "they get ever smaller" he doesn't know
@nameguy1018 років тому
You didn't have to re-upload. Just add the tag "yt:stretch=16:9" to the original video.
@jensw.61738 років тому
+Nameguy didn't work & would also stretch the slides...
@karnajitw6 років тому
Awesome point 4:30
@User-cv4ee2 роки тому
I had fun learning something new but that's about the extent of it. I would not remember any of the details after a week, except for some key takeaways which could have been like 5 slides. Great talk nonetheless.
@ochgottnochma8 років тому
To help dem lost culture in germanies: The Goldilocks principle is derived from a children's story "The Three Bears" in which a little girl named Goldilocks finds a house owned by three bears. Each bear has its own preference of food and beds. After testing all three examples of both items, Goldilocks determines that one of them is always too much in one extreme (too hot or too large), one is too much in the opposite extreme (too cold or too small), and one is "just right".[1]
@jrmoultonРік тому
✅
@533rosy7 років тому
What was the bug at 18.40?
@JohannesSchreiner17 років тому
The arguments to the phi-node are flipped!
@Shockszzbyyous7 років тому
i think i don't understand why must they be flipped to be right?
@andydufresne93872 роки тому
those dots on the wall make me dizzy
@juzujuzu45555 років тому
It sucks that we can't unite and put our collective effort on researching better optimizations, tools and methods that allow those optimizations etc. How many devices we have that run C/C++ coded kernel and software? If those devices are battery powered, then saving CPU is having even more benefits. All major software and hardware giants should donate to this research, or participate at least somehow. Interesting question is what is theoretically possible, or what can we know for sure is or isn't possible, if we would have like exabyte of ram and exa instruction per second CPU and couple of days time to wait for the compiler to optimize. Perhaps in the future we compile the production quality version by sending our sources to supercomputer that does the optimization. While this sounds funny right now, there are still lots of thought behind these lines that hold truths. Anyway, bug free coding to you all =)
@azizas93666 років тому
The prerequisite for this talk: Assembly language.
@TheBilly4 роки тому
The Intermediate Representation may resemble assembly language, but it is not. It is abstract, representing operations on values but not machine-level operations on memory locations and physical registers.
6 років тому
"The keyword inline has nothing to do with optimization"... Say that again?
@jonesconrad15 років тому
it tells the compiler the symbol or function can appear in multiple translation units and not to freak out, it does not tell the compiler to inline it.
@greenfloatingtoad3 роки тому
It sometimes gives a hint to the compiler but the compiler is free to ignore it (or decide to inline something you didn't mark inline) The only guarantee is inline allows repeating the definition in multiple translation units
3 роки тому
@@jonesconrad1 But it allows it, so it has something to do with it, a lot actually #ThatsWhyPeopleUseInlinePrimarily
@TheEVEInspiration6 років тому
Compiler and language builders are doing something wrong if they consider "const" as not helpful. It is information and can be a guarantee something does not get modified. That the "constness" can be casted away for out of program "API reasons" is no excuse. Having such a cast anywhere else in the code is just as bad as a non-atomic memory access in a multi-threaded application and would just be a bug. People link libraries, and especially there, knowing a provided argument will not change during a library call is gold. There is no other way to optimize that case with the same guarantee that the argument will not change. It is not the first time I seen this attitude among language and compiler builders and it annoys me quite a bit.
@Verdagon5 років тому
(Not counting const_cast) I believe you're mixing up "const" with "immutable". When I have a const reference to something, there's a guarantee that I won't change it, but there's no guarantee that nobody else will change it. See stackoverflow.com/questions/4486326/does-const-just-mean-read-only-or-something-more I think what you want is a language that takes immutability into account, so you'd want something like functional languages or Rust.
@nicolasabramlujan4 роки тому
I believe you could make an argument that that's a language level issue and not really the compiler's fault
@whydoineedausername13864 роки тому
@@Verdagon Rust pretty much ignores immutability when compiling because LLVM is so buggy when you have so many consts. Yes really. It used to but then they had to disable it because of LLVM bugs
the alk gave me idea about compiler innerworking....................
@Fl4shback7 років тому
Claiming that C++ is the fastest with least overhead and totally forgetting about C.... Not saying that C is completly superior but it is still quite relevent in these aspects...
@MeetingCPP7 років тому
Well, C++ is superior, as it has access to a different feature set, that isn't available to C. While C is a subset of C++...
@cthutu7 років тому
I disagree. In theory it can be but in practice it isn't due to way C++ is normally used. The way C++ classes tend to be organically made plays havoc with the cache and is very anti-data-oriented.
@Fl4shback7 років тому
Saying that C is a subset of C++ is completly wrong. They are different languages with different grammar. Expressions can be valid in one but illegal in the other. And BECAUSE of the bigger "feature set" it starts with a disadvantage for optimization, given that nowadays this is not really an issue. Still if C++ would be superior in every aspect then C would not be the number 1 language in embedded development( at least this is what I last saw in usage polls). Still I don't say C is generally superior, I just say C++ is not generally better than C nor is C a subset of C++. They evolved differently.
@Dima-ht4rb6 років тому
Spot C programmer.
@kristupasantanavicius90935 років тому
C++ is a mix of high level Java like programming mixed with the possibility of using pure C anytime you desire. That is what makes it so powerful.