Docsity

Thread-Level Speculation & POSH: Compiler for Parallelizing Hard-to-Parallelize Code, Study notes of Computer Science

Partial preview of the text

Download Thread-Level Speculation & POSH: Compiler for Parallelizing Hard-to-Parallelize Code and more Study notes Computer Science in PDF only on Docsity!

Dimitrij Krepis

Dept of Computer & Information Sciences

University of Delaware

POSH: A TLS Compiler that Exploits Program Structure

Outline

• Introduction to Thread Level Speculation

• POSH: TLS Compiler

• Implementation

• Experimental Platform

• Results

How to deal with data

dependency

Source: www.cs.cmu.edu/afs/cs.cmu.edu/academic/class/15740-f01/public/ doc/discussions/multiprocessors/tls.ppt

No data Dependency With Data Dependency

Original i= j= … a= b=c ... Thread i+ a= b=c … Thread i i= j= … Original i= j= … a= b=j ... Thread i+ a= b=j … Thread i i= j= …

“False” data dependency

Source: www.cs.cmu.edu/afs/cs.cmu.edu/academic/class/15740-f01/public/ doc/discussions/multiprocessors/tls.ppt

while

(continue_condition)

x=hash[index1];

hash[index2]=y;

Thread i

=hash[3] … hash[10]=..

Thread i+

=hash[19] … hash[21]=..

Compiler can not fully exploit potential parallelism.

Thread-Level Speculation

Benefits

Thread-Level Speculation

(cont.)

Source: www.cs.cmu.edu/afs/cs.cmu.edu/academic/class/15740-f01/public/ doc/discussions/multiprocessors/tls.ppt

• Speculative Parallel Execution

• Dynamically Detect Dependency in Run-Time

Thread 1 =hash[3] … Hash[10]=.. Thread 2 =hash[19] … Hash[21]=.. Time Thread 3 =hash[10] … Hash[21]=.. Processor 0 Processor 1 Processor 2

POSH

• Fully Automated TLS Compiler

• Built on GCC 3.

• Works on hard-to-parallelize code.

• Partitions code into tasks

• Subroutines and loops.

• Profiling

• Discards ineffective tasks.

POSH: HW Assumption

• Shared Memory CMP

• No register transfer between tasks

• Write-Through on Registers

• Guaranteed by POSH

• All Live-Ins via Memory

• Detects Data Dependency Violations

• HW Squashes and Restarts Tasks

• Spawn, Commit instructions.

POSH: Task Selection

• Identify Tasks

• Subroutines, Subroutine continuations

• Loop Iterations/Continuations

• For Each Task

• Identify Beginning and End.

• Inserts Commits before every task.

• Value Prediction

• Reduces data dependency violations

• Function return values/loop induction variables.

POSH: Spawn Hoisting

• Inserts SPAWN instructions at beginning of

all tasks.

• Spawn Points.

• Hoists tasks as early as possible

• Improves Parallelism and Prefetching.

• Restrictions:

• Spawning before the definition of variable used.

Except Value prediction.

• Control Flow Restrictions

• Spawning in reverse order.

POSH: Profiling

• Train Input Set

• Sequential Execution

• Models simple Cache

• Estimated Cache misses.

• 5min execution on desktop.

• Assigns time to each instruction

• Rewinds time to spawn point + Overhead time.

• On Load, lookup in Store table.

• Load timer<Store Timer: dependence violation.

POSH: Profiling (cont)

• On violation:

• Squash consumer task

• Update instruction times.

Experimental Results:

SPEC

Experimental Results

Prefetching