Тёмный

9. What Compilers Can and Cannot Do 

MIT OpenCourseWare
Подписаться 5 млн
Просмотров 77 тыс.
50% 1

MIT 6.172 Performance Engineering of Software Systems, Fall 2018
Instructor: Tao B. Schardl
View the complete course: ocw.mit.edu/6-...
RU-vid Playlist: • MIT 6.172 Performance ...
T.B. Schardl discusses the Clang/LLVM compilation pipeline as well as reasons to study compiler optimizations, how to use compiler reports, and compiler optimization. Three case studies on diagnosing failures are examined.
License: Creative Commons BY-NC-SA
More information at ocw.mit.edu/terms
More courses at ocw.mit.edu

Опубликовано:

 

7 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 59   
@leixun
@leixun 3 года назад
*My takeaways:* 1. Why study the compiler optimizations? 4:05 2. Simple model of the compiler 8:30 3. Compiler report 9:33 4. Overview of compiler optimizations 13:20 5. Example compiler optimizations 26:00 - Optimizing a scalar 30:20 - Optimizing a structure 33:56 - Optimizing function calls 43:10 - Optimizing loops 56:05 6. WHat compilers can and cannot do 1:04:25 7. Diagnosing failures: case studies 1:06:30
@abevigoda3149
@abevigoda3149 2 года назад
Those times when the compiler de-optimizes sections of your code or introduces elusive "bugs" in your code, similar to what happened to me when the MFC were still in development and I was programming for Win NT, the good "o'l" times.
@MikhailGoncharov-tl4cr
@MikhailGoncharov-tl4cr Год назад
Those times when the compiler de-optimizes sections of your code or introduces elusive "bugs" in your code, similar to what happened to me when the MFC were still in development and I was programming for Win NT, the good "o'l" times.
@elliott8175
@elliott8175 3 года назад
@25:43, the reason for choosing 38 is because it's a dealing with a 32-bit integer on a 64-bit register, so we have an extra 32 bits to play with. 71 > 64 = 2^6, so magic_num = 2^38/71 is definitely less than 2^32, so num_32 * magic_num shifts the top bit by no more than num_32
@bibanez135
@bibanez135 Год назад
Thank you for the explanation. 2^38/71+1=3871519817, which is the number that appear in the slides, so the +1 rounding is pre-calculated.
@robertplautz9722
@robertplautz9722 3 года назад
what a great teacher! thank you!
@proweiqi
@proweiqi 4 года назад
This is a great lecture
@pschneider1968
@pschneider1968 2 года назад
I'm glad I don't have to write a compiler 😉🙏
@abdulshabazz8597
@abdulshabazz8597 2 года назад
A compiler appears to choose optimal decision branches based upon the choices available. This methodology is similar to substitution networks in theorem provers. Perhaps theorem provers built into compilers will become the first A.I. driven constructs to achieve true sentience and artificial intelligence. Imagine a compiler that understands algebra, philosophy, and all scientific topics, including physics. With the ability to generate and reason over its own code, the compiler would become the ultimate decision maker.
@alang.2054
@alang.2054 9 месяцев назад
Bullshit. These all decisions magical compiler makes are just code, nothing more. Someone had to wrote this, maybe from some researcher's paper, nothing more. Stop hallucinating
@WhiteDragon103
@WhiteDragon103 Год назад
Ahem, the problem at 1:06:00 is very much optimizable by looking at a computation graph and seeing that the two sequences for F12 and -F21 are algebraically equivalent, without needing to know physics.
@bibanez135
@bibanez135 Год назад
In the slide it says "unlikely" that it will do so, so maybe it could do it in some cases. Although, two numbers that resulted in the same were not necessarily calculated the same way, and I guess the compiler can be wary
@MikhailGoncharov-tl4cr
@MikhailGoncharov-tl4cr Год назад
@@bibanez135 please tell me in detail what you mean. give at least one example
@danielkrajnik3817
@danielkrajnik3817 3 года назад
13:30 yeah not gonna lie they got us in the first half
@user-pg9te8ug1j
@user-pg9te8ug1j 2 года назад
Fantastic content. Chapeau to the tutor.
@TranscendentBen
@TranscendentBen 3 года назад
I just saw the video "restrict: the only C keyword with no C++ equivalent" - inexplicably, I'd never seen the restrict keyword before.
@sortof3337
@sortof3337 4 года назад
Thank you for this course. :)
@kewtomrao
@kewtomrao 2 года назад
For anyone wondering, eax is lower 32 bits of rax
@erikvesa8850
@erikvesa8850 Год назад
Thank you for these lectures, this one was absolutely amazing 🎉
@gsxrveli
@gsxrveli 2 года назад
teacher is beyond smart! Great lecture!
@AlFredo-sx2yy
@AlFredo-sx2yy Год назад
"What about GCC? I have a 20 thousand line DIVINE intellect compiler that operates Just In Time AND ahead of time."
@pragmatic_p8
@pragmatic_p8 3 года назад
Watched this video to understand minisicule things in Optimization by compiler...hope this give me clear understanding in design of compilers and for my gate prep..
@hareeshr3791
@hareeshr3791 2 года назад
Are you preparing for GATE CS 2022?
@lohphat
@lohphat Год назад
What frustrates me is that compilers don't take advantage of advanced instruction intrinsics automatically enough -- most of the modern CPU optimized SIMD/AVX instructions go unused. You have to manually construct SIMD usage most of the time which makes it a fools errand most of the time unless you're compiling code for your own system. If you're going to distribute compiled software, you have to dumb it down to a neutral architecture that doesn't risk using unsupported opcodes on the target system.
@entaditorium
@entaditorium 2 года назад
As a compiler engineer, i was interested in the part where professor describes what compilers can't do. And what he describes appears to be true! It will be a real challenge to establish if two forces cancel each other. We could certainly encode rules (or laws of Physics for this example) as type constraints and then compiler may be able to figure that out but that is probably years ahead of the scope of modern compilers.
@bibanez135
@bibanez135 Год назад
What the compiler can't do, it's what's implied for the current developer to optimize. Specifically simulations lend themselves to working out the math and solving it satisfyingly before implementing it in code
@MikhailGoncharov-tl4cr
@MikhailGoncharov-tl4cr Год назад
@@bibanez135 What the compiler can't do, it's what's implied for the current developer to optimize. Specifically simulations lend themselves to working out the math and solving it satisfyingly before implementing it in code
@PeterJones74
@PeterJones74 4 года назад
He even looks like a genious :)
@jilongzhang1851
@jilongzhang1851 3 года назад
I think he looks like Neymar :)
@sbalogh53
@sbalogh53 2 года назад
At first I thought he had an "interesting" beard, but then I forgot about his looks and listened intently to what he had to say. Great lecture.
@about2mount
@about2mount 3 года назад
The greatest computer language to develop a Lexical Analyzer and a Compiler for any computer language is CPython hands down. In fact CPython's Regular Expression re.sub() methods and string replace methods work in multiple algorithms nested and can handle the heavy lifting end of both exceptionally well. Under 280 lines of code will do both, and do some things today's compilers cannot do.
@MikhailGoncharov-tl4cr
@MikhailGoncharov-tl4cr Год назад
please give me the one example, for the learning
@SalesforceUSA
@SalesforceUSA 3 года назад
I don't know why RU-vid recommended this to me, but I stayed for the whole lecture.
@shashikalaraju5769
@shashikalaraju5769 2 года назад
You must be knowledgeable with this sort of bend
@alexyakoveno4682
@alexyakoveno4682 Год назад
@Rfc1394
@Rfc1394 2 года назад
I just realized why the '32 seconds' timing claim is wrong. Now, we can presume the processor has 16 cores, each with only one thread, that could execute 32 billion instructions per second. Except for one thing. Memory. Fastest memory DDR4-4400 has sustained transfer rate 4.4 gb/sec, throttling processors to that., and, ia64/AMD64 instructions run from 1-15 bytes each. If we estimate an average of 4 bytes per instruction, at that rate it requires 40 terabytes of ram, and that would require 4,000 seconds (6 1/2 hours) at the 4.4 ghz rate. Now there is a burst speed of 35gb/sec, so if you could run the memory that fast, at the 35gb/sec burst rate (and I don't think you'd get burst speed continuously) it would take about 120 seconds.
@abevigoda3149
@abevigoda3149 2 года назад
4,000 seconds = 1 hour 6 minutes 40 seconds... Just saying. Enough to not even check the rest of your "calculations" SMH
@pipony8939
@pipony8939 2 года назад
@@abevigoda3149 sir can you please explain the conclusion for the 32 seconds?
@forheuristiclifeksh7836
@forheuristiclifeksh7836 6 месяцев назад
17:06
@ariloops
@ariloops 3 года назад
Werever dando clases.
@w1d3r75
@w1d3r75 3 года назад
Hacker's delight book
@pipony8939
@pipony8939 2 года назад
what about it sir?
@w1d3r75
@w1d3r75 2 года назад
@@pipony8939 it contains a lot of tricks involving the use of bits operators
@pipony8939
@pipony8939 2 года назад
@@w1d3r75 ok thanks. he did mentioned it on later videos. is there a way to contact you? i want to understand this topic better and especially compilers.
@w1d3r75
@w1d3r75 2 года назад
@@pipony8939 I don't know anything about compilers or bit operations. I was mentioning the book
@bramblebop1904
@bramblebop1904 9 месяцев назад
The guy stands there looking lime an über-dork in his charlie-chaplin pants and with the stupid beard, if you can call it that... Then he starts to talk, and my god. Perception totally changes, suddenly he's an athletic giant, lol. 👍 Intellect is attractive. 👍
@saddicticallee8090
@saddicticallee8090 2 года назад
Ok I I
@MikhailGoncharov-tl4cr
@MikhailGoncharov-tl4cr Год назад
please, if you are not difficult tell me the main conclusion of this video in one minute. please
@JG_1998
@JG_1998 Год назад
You have to be kind of sick in the head to think studying how a compiler works is fun ;). It is quite interesting, but it's definitely not "fun" for the average engineer/computer scientist. I guess that's why he's at MIT lol.
@imnikhil3831
@imnikhil3831 Год назад
well if u gotta be a good coder, u've to know the inside out of what is going on, infact the shallow minds are lazy, stuck and might be sick as they seek quick results with little effort
@JG_1998
@JG_1998 Год назад
@@imnikhil3831 i agree, which is why I'm watching this series on compiler design. I don't think I need to take the full class at my university, but it is helpful to know a decent amount about the compiler and not leave it as a black box.
@alang.2054
@alang.2054 9 месяцев назад
It is very fun for me, even I would call it more interesting than kernel / low level development, for sure more interesting than all these popular websh*t / business logic jobs
@Er.Sunil.Pedgaonkar
@Er.Sunil.Pedgaonkar Год назад
But what is his education, CV? -- Er. Sunil Pedgaonkar, India, Consulting Engineer (IT), India
@hamiltonborah4834
@hamiltonborah4834 3 года назад
Here for neymar
Далее
10. Measurement and Timing
1:21:28
Просмотров 18 тыс.
Compilers, How They Work, And Writing Them From Scratch
23:53
Friends
00:32
Просмотров 958 тыс.
ПРОСТИ МЕНЯ, АСХАБ ТАМАЕВ
32:44
Просмотров 2,3 млн
How do computers read code?
12:01
Просмотров 3,1 млн
A 90-year-old Unsolved Telephone Question
28:45
Просмотров 68 тыс.
before you code, learn how computers work
7:05
Просмотров 291 тыс.
Why Democracy Is Mathematically Impossible
23:34
Просмотров 3,6 млн
Fast Inverse Square Root - A Quake III Algorithm
20:08
Optimising Code - Computerphile
19:43
Просмотров 146 тыс.
C++ vs Rust: which is faster?
21:15
Просмотров 392 тыс.
Friends
00:32
Просмотров 958 тыс.