Message board for the users of flat assembler.
> Heap > Auto-threading
Slashdot is covering a new compiler feature from Microsoft - Auto-threading
The gist of the development is the new feature whereby the code that was written for a single thread can be "taught" by the compiler to become a multi-threading program, if that program runs on a multi-core (and/or hyperthread) environment.
The link is at http://developinthecloud.drdobbs.com/author.asp?section_id=2284&doc_id=255275&
|04 Dec 2012, 02:07||
Here is an example of code:
#1. A loop which runs 10 times.
#2. A loop which runs a billion times.
If the loop counter comes from a variable and is not a constant, there is no way for a compiler to know
which loop is better to multi-core and which will induce the overhead if it tries to multi-core it.
I say, leave that to human coders.
Besides, the multi-coring should be done only for some long processing tasks.
IMO only humans know where these tasks are in a program.
|04 Dec 2012, 14:04||
This is very interesting work - I've only super-fastforward-skimmed the paper, but it seems (im)mutability is being baked into the type system... this isn't "just" about auto-parallelizing, but about expanding the semantics used for describing your code, also allowing the compiler to catch even more classes of programming errors.
For instance, from the paper:
Anecdotally, they claim that the further they push reference immutability through their codebase, the more bugs they ﬁnd from spurious mutations. The main classes of bugs found are cases where a developer provided an object intended for read-only access, but a callee incorrectly mutated it; accidental mutations of structures that should be immutable; and data races where data should have been immutable or threadlocal (i.e. isolated, and one thread kept and used a stale reference).
Probably not something we'll see in mainline C# anytime soon, but any work on reducing the complexity of writing parallel code is good - and it's nice seeing that not all work is concentrated on pure functional programming
One can use annotations to signal that "this piece of code might work on huge collections", and not have the compiler try to parallelize if that flag isn't set... at runtime, a parallelized or single-threaded version can be selected depending on input. This is different from existing stuff such as OpenMP or C#'s TPL in that those are very explicit about what is being done, and doesn't encode information in the type system.
With an augmented type system, the compilers and JIT'ers have a lot more information to base their decisions on. This could end up giving some nice automatic optimizations - but I find that bug detection is at least as interesting.
|04 Dec 2012, 15:19||
< Last Thread | Next Thread >
Copyright © 1999-2020, Tomasz Grysztar.
Powered by rwasa.