flat assembler
Message board for the users of flat assembler.

Index > Heap > Auto-threading

Author
Thread Post new topic Reply to topic
kalambong



Joined: 08 Nov 2008
Posts: 165
kalambong
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&
Post 04 Dec 2012, 02:07
View user's profile Send private message Reply with quote
AsmGuru62



Joined: 28 Jan 2004
Posts: 1412
Location: Toronto, Canada
AsmGuru62
Interesting...

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.
Post 04 Dec 2012, 14:04
View user's profile Send private message Send e-mail Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3170
Location: Denmark
f0dder
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:
Quote:
Anecdotally, they claim that the further they push reference immutability through their codebase, the more bugs they find 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 Smile

Quote:

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.
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.
Post 04 Dec 2012, 15:19
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.