1,316 karma · joined Mar 25, 2012 (14y ago) · 181 submissions
61.
Cloud TPU Pods Break AI Training Records(cloud.google.com ↗)
2 points · by cokernel_hacker · 7y ago · discuss
62.
Google’s Cloud TPU Pods are now publicly available in beta(cloud.google.com ↗)
148 points · by cokernel_hacker · 7y ago · 71 comments
comment 7y ago · link · parent
Google makes it pretty clear that they do not sell any personal information to advertisers: https://safety.google/privacy/ads-and-data/
comment 9y ago · link · parent
comment 9y ago · link · parent
I also wonder if this will be one of those things which youngins' will take for granted someday...
comment 10y ago · link · parent
For more details, see http://blog.llvm.org/2010/04/intro-to-llvm-mc-project.html
67.
Initial patches to add an MC layer for RISC-V(llvm.org ↗)
31 points · by cokernel_hacker · 10y ago · 14 comments
69.
Inter-Procedural Optimization and Derefinement(playingwithpointers.com ↗)
2 points · by cokernel_hacker · 10y ago · discuss
comment 10y ago · link · parent
Steve's book, The Algorithm Design Manual, was pretty inspirational to me in high school. Arch did a compiler, KAI C++, and designed Intel's TBB library (Thread Building Blocks).
comment 10y ago · link · parent
The way C++ exceptions are used creates very interesting interactions in the design of their implementation.
There a hidden cost many forget: call frame information restricts what the compiler can do. Why is this the case? Even if exceptions are super rare, the compiler still needs to make sure the program will obey the language rules if an exception is somehow thrown at an appropriate program point.
The compiler must emit instructions which can be represented by the call frame information in order for the unwind to be able to reason about the stack.
This is usually not a problem on Linux because the DWARF CFI is very expressive. That expressiveness comes at a cost: it is quite inefficient when it comes to size.
Other platforms, Windows NT (ARM, x64 and IPF) and iOS, recognized that this increase in size is a bad state of affairs and thus aimed to make the CFI more compact. By doing this, they greatly reduced the size of CFI but unfortunately created restrictions on what a compiler can do.
As for trickiness inherent in C++ exceptions, C++ supports a fairly esoteric feature: exceptions may be rethrown without being in a try or catch:
void rethrow() {
throw;
}
An easy way to make this sort of thing work would be to thread a secret in/out parameter which represents the exception state.But how is this typically implemented?
Well, remember, the ethos of exceptions in C++ is that they are rare. Rare enough that implementors are discouraged from optimizing the speed of C++ exceptions.
Instead, thread local storage is typically used to go from any particular thread back to it's context.
Things get pretty darn complicated pretty quickly with features like dynamic exception specifications:
void callee() throw(double) {
throw 0;
}
void caller() {
try {
callee();
} catch (...) {
puts("got here!");
}
}
On first examination, "got here!" should be unreachable because the call to "callee" results in a violation of the exception specification.However, this is not necessarily the case! What _actually_ happens is that some code runs between the throw and the catch: std::unexpected is called.
Now, std::unexpected might throw an exception of it's own! If this new exception matches the exception specification, the exception would pass into the catch block in "caller". If it doesn't, the exception thrown within std::unexpected might result in another violation!
Wow, this is get complicated... OK, so what happens if it results in another violation? Well, the exception gets cleaned up and replaced with, you guessed it, another exception! We'd be left with an exception of type std::bad_exception leaving std::unexpected and thus "callee". Because the catch clause in "caller" is compatible with std::bad_exception, control is transferred to the catch block.
This is the tip of the iceberg. A huge amount of machinery is sitting around, waiting to engage to make exceptions work.
comment 10y ago · link · parent
Let's start with an excellent quote from Wittgenstein. "The limits of my language mean the limits of my world."
Using C as your intermediate language means that your expressiveness is limited to valid C programs. This is workable but only if your language can be mapped to C in _useful_ ways.
For example, let's say your language has behavior similar to scheme's tail-call. How would you get this behavior from a C compiler? You will never be able to make this reliably across optimization levels, etc.
Guaranteed tail-calls are the tip of the iceberg, there are a lot more features which cannot be reasonably mapped onto C.
Real compiler IRs increase your expressivity beyond what the C language designers decided was important.
comment 10y ago · link · parent
It is incredibly useful to talk about a loop's trip count or the values an induction variable can have.
It turns out that taking advantage of signed overflow lets us do that in more places, a boon to all the programs which don't dynamically execute signed overflow.
The tradeoff, however, is that the programing model gets way more complicated. I have talked to the engineer who introduced this optimizing power to our compiler and he sorta regrets it.
IMO, we need better, higher level ways of talking about a loop's iteration space. Today, in C or C++, we are forced to represent the iteration space of a loop using the language's algebra. This is severely limiting when each operation on a signed type might introduce UB. With a higher level mechanism, we can separate the behavior that we want for loops from the behavior we want for everything else in a nice, clean way.
comment 10y ago · link · parent
The sharpest thorn, to me, is: what happens when you are running inside the critical section and your thread gets preempted?
Well, now the next thread which tries to acquire the lock is stuck waiting. But waiting for what? Waiting for the original thread to get scheduled.
Now, the OS has no idea that the original thread should get scheduled again and is free to continue scheduling more and more work items.
Fortunately for the lock in this article, and most other locks which spin, it is adaptive and will not spin for too long. But how long is long enough? If the spin is timed for a few loads and stores, then all is probably well as spins will not be attempted for very long.
I wonder how these locks figure out how long they should spin? In the nasty case I previously mentioned, you'd want to spin for a very short while to avoid large amounts of waste. But spins which are too short lead to higher lock/unlock latency if the lock was held for any appreciable amount of time.
This leads me to the following conclusion: spinning inevitable leads to _some_ number of wasted CPU cycles and therefore increased latency.
I'm curious as to how the amount of spinning was chosen.
comment 10y ago · link · parent
SSA is a program representation which is easy for compilers to analyze and optimize. See https://en.wikipedia.org/wiki/Static_single_assignment_form for more.
comment 10y ago · link · parent
bool f(bool b) {
int x;
try {
if (b) {
x = 2;
throw 0;
}
x = 4;
throw 0.0;
} catch (...) {
}
return x & 1;
}
Here, a phi is needed on the catch.Out of curiosity, can you give details regarding how your EH representation looks like in SSA?
comment 10y ago · link · parent
It also sounds like they have something like LLVM's InstCombine pass, it'll be interesting to compare which cases they handle. Despite it being a peephole pass, InstCombine is actually one of the most important scalar optimizations in LLVM's arsenal.
I also wonder if they form SSA in the face of C++ and/or SEH exceptions.
Like if you have something like:
bool f() {
int x = 2;
try {
throw 0;
} catch (...) {
x = 4;
}
return x & 1;
}
Will they insert a PHI of 2 and 4?
The MSVC of today cannot optimize the return to a constant.comment 10y ago · link · parent
We are still using X, still using terminals powered by control codes, etc.
Rob probably sees things like LANG and LC_ALL as bugs. His fix was UTF-8 everywhere, always. Where is Linux? Still in bag-of-bytes-o-rama.
comment 10y ago · link · parent
http://blogs.msdn.com/b/slavao/archive/2005/02/05/367816.asp...
comment 10y ago · link · parent
#pragma weak, asm labels, always_inline, debug information, attribute regparm, inline assembly, etc...
All of this is doable via incremental lowering from the AST (this is how clang does it) but it is fairly painful.
Even the relatively banal:
enum e;
void (*fp)(enum e);
enum e { v = 1ULL << 32 };
results in quite a bit of gymnastics! (https://github.com/llvm-mirror/clang/blob/202433cccd87a4e7d1...)86.
2016 European LLVM Developers' Meeting(llvm.org ↗)
2 points · by cokernel_hacker · 10y ago · discuss
87.
David Patterson is Retiring(amplab.cs.berkeley.edu ↗)
4 points · by cokernel_hacker · 11y ago · discuss
88.
WebAssembly: Here Be Dragons [video](youtube.com ↗)
36 points · by cokernel_hacker · 11y ago · 3 comments