automatically exploiting cross-invocation parallelism using runtime ...

automatically exploiting cross-invocation parallelism using runtime ... automatically exploiting cross-invocation parallelism using runtime ...

dataspace.princeton.edu
from dataspace.princeton.edu More from this publisher
13.07.2015 Views

checkpoint, the child spawns new worker threads, and each newly spawned thread executeslongjmp to inherit the program state of an original thread.SPECCROSS explicitly allocates worker threads’ stacks to ensure they will not be deallocatedby fork.This is necessary, because the POSIX standard allows processes todeallocate the stacks of associated threads after forking. Explicitly allocating the workerthreads’ stacks ensures that longjmp will restore a valid stack.Experiments show recovering from misspeculation requires about one millisecond.The execution time for recovering non-speculative state is dominated by the kill andclone syscalls. The main thread invokes kill to asynchronously terminate misspeculatingthreads and awaken the checkpoint process, then invokes clone (internally calledby pthread create) to create new worker threads. The number of syscalls scales linearlywith the number of threads, but performance is not affected by the program’s memoryfootprint or the size of speculative state.Some epochs contain irreversible operations (for example I/O) which must be executednon-speculatively. Before entering an irreversible epoch, all worker and checker threadssynchronize. Just like checkpointing, synchronizing all threads ensures non-speculativeexecution. After exiting the irreversible region, the program checkpoints. Otherwise, latermisspeculation could cause the irreversible region to be repeated.There are three conditions which trigger misspeculation. First, the checker thread triggersmisspeculation if it finds a pair of conflicting signatures. Second, misspeculationoccurs if any of the worker threads triggers a segmentation fault. Third, misspeculationcan be triggered in response to a user defined timeout. Timeouts are necessary, since speculativeupdates to the shared memory may change the exit condition of a loop and causeinfinite execution. After detecting misspeculation, the most recent checkpoint is restored.After restoring the checkpoint, the misspeculated epochs are re-executed with all speculativebarriers replaced with their non-speculative counterparts.64

4.2.3 Runtime InterfaceThis section describes the runtime interface exposed by SPECCROSS. Table 4.1 lists theinterface functions along with a short description of each function’s semantics. Figure 4.9shows an instantiation of these functions in a parallel program which will serve as a runningexample. In the example, each inner loop invocation is treated as an epoch, and each innerloop iteration is considered a task. SPECCROSS provides the same interface functions forboth profiling and speculation purposes. As a result, these function calls only need to beinserted once for both profiling run and speculative execution. Whether to do profilingor speculation is decided by defining the environment variable MODE. Depending on thecurrent MODE, functions will either speculate or profile. The MODE value can also be set toNON-SPECULATIVE. In non-speculative mode, most interface functions do nothing andspeculative barriers are replaced with non-speculative ones. This non-speculative mode isenabled when re-executing the misspeculated epochs after recovering from misspeculation.The details of SPECCROSS’s profiling and speculation functions are as follows:65

checkpoint, the child spawns new worker threads, and each newly spawned thread executeslongjmp to inherit the program state of an original thread.SPECCROSS explicitly allocates worker threads’ stacks to ensure they will not be deallocatedby fork.This is necessary, because the POSIX standard allows processes todeallocate the stacks of associated threads after forking. Explicitly allocating the workerthreads’ stacks ensures that longjmp will restore a valid stack.Experiments show recovering from misspeculation requires about one millisecond.The execution time for recovering non-speculative state is dominated by the kill andclone syscalls. The main thread invokes kill to asynchronously terminate misspeculatingthreads and awaken the checkpoint process, then invokes clone (internally calledby pthread create) to create new worker threads. The number of syscalls scales linearlywith the number of threads, but performance is not affected by the program’s memoryfootprint or the size of speculative state.Some epochs contain irreversible operations (for example I/O) which must be executednon-speculatively. Before entering an irreversible epoch, all worker and checker threadssynchronize. Just like checkpointing, synchronizing all threads ensures non-speculativeexecution. After exiting the irreversible region, the program checkpoints. Otherwise, latermisspeculation could cause the irreversible region to be repeated.There are three conditions which trigger misspeculation. First, the checker thread triggersmisspeculation if it finds a pair of conflicting signatures. Second, misspeculationoccurs if any of the worker threads triggers a segmentation fault. Third, misspeculationcan be triggered in response to a user defined timeout. Timeouts are necessary, since speculativeupdates to the shared memory may change the exit condition of a loop and causeinfinite execution. After detecting misspeculation, the most recent checkpoint is restored.After restoring the checkpoint, the misspeculated epochs are re-executed with all speculativebarriers replaced with their non-speculative counterparts.64

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

Saved successfully!

Ooh no, something went wrong!