13.07.2015 Views

automatically exploiting cross-invocation parallelism using runtime ...

automatically exploiting cross-invocation parallelism using runtime ...

automatically exploiting cross-invocation parallelism using runtime ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

takes up to 200MB memory space.To detect misspeculation, the checker thread needs the memory access signatures, theworker thread’s epoch and task numbers and the epoch and task numbers of the otherworker threads when the task began. After sending the data to the checker thread, a workerthread may stall to wait for other worker threads if continuing execution would exceed thespeculative range. In Figure 4.6, thread 4 stalls after executing task . When thread4 tries to start task , it determines the distance to thread 3’s task is three. Inthe example, the speculative range limit is two, so thread 4 stalls until thread 3 finishes task. The example is simplified, since in real programs the speculative range is alwaysat least the number of threads and usually much larger.There are two subtle memory consistency issues with the checking scheme describedabove. First, the checking scheme assumes that updates to the epoch and task numberswill be globally visible after all other stores in the previous task. If the memory consistencymodel allows the architecture to reorder stores, this assumption will be false. In otherwords, the checking methodology assumes a Total Store Order (TSO) architecture. ModernTSO architectures include: x86, x86-64, SPARC, and the IBM zSeries [41]. For architecturesthat do not support TSO, such as ARM and POWER, each thread should execute amemory fence before updating the epoch and task numbers. The costs of memory fencesmay be greater than the costs of speculative barriers when the number of tasks per epoch ishigh.Second, the epoch and task numbers must update together atomically. The easiest wayto accomplish this is to store these numbers as the high and low bits of a 64-bit word anduse an atomic write operation. For x86-64, 64-bit writes are atomic by default, so no specialhandling is required.62

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!