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

Operation DescriptionFunctions for Both Profiling and Speculationinit() Initialize data structures used for barrier profiling or speculative execution.If in speculation mode, checkpoint the program before beginningthe parallel execution.exit task(threadID) Record the signature of the current task in global signature log.Increment the task number. If in profiling mode, compare the signature ofcurrent task with signatures of tasks belonging to previous epochsand return the minimum dependence distance.If in speculation mode, return value is 0.spec access(threadID, callback, addr list) Apply callback function to each address in the addr list to computethe signature.enter barrier(threadID, loop name) Increment the epoch number. If in profiling mode, execute the actualnon-speculative barrier operation. If in speculation mode, checkpoint according tothe checkpointing frequency.create threads(threads, attrs, start routines, args) Create worker threads and if in speculation mode, create a checkerthread for violation detection.cleanup() Wait for worker threads and checker thread to finish.Free data structures allocated for profiling or speculation.Functions for Speculation Onlyenter task(threadID, spec distance) Collect epoch number and task number of other worker threads andsend them to the checker thread. The parameter spec distance specifiesthe speculation distance between two tasks.send end token(threadID) Send an END TOKEN to checker thread to inform it of the completionof a worker thread.sync() Synchronize all threads before entering the next epoch.checkpoint() Checkpoint program state before entering the next epoch.Table 4.1: Interface for SPECCROSS Runtime Library66

1. Initialization. The init function performs initialization by setting up bookkeepingdata structures, including allocating memory for signatures, the epoch number,and the task number. In speculation mode, init checkpoints the program beforebeginning parallel execution.2. Thread Creation. The create threads function spawns new threads in bothprofiling and speculation modes. Unlike pthreads, a SPECCROSS thread’s stack isnot deallocated after the thread exits. This implementation detail is vital for checkpointingand recovery, because it allows a new thread to reclaim an old thread’s stackusing longjmp.3. Barrier Entry. The enter barrier function increments the epoch number uponentry into a new epoch. In profiling mode or non-speculative mode, it executes thenon-speculative barrier. The parameter loop name is set to be the name of the loopheader basic block so that profiling could compute a minimum dependence distancefor each independent loop. While in speculation mode, it skips barrier synchronization.The enter barrier function is also responsible for periodically checkpointingspeculative state.4. Dependence Tracking. To compute the access signatures for each task, its memoryaccesses (loads and stores) are instrumented using the spec access function.Loads and stores need to be instrumented if they belong to different epochs and mayalias with each other. For typical programs, only a few memory accesses requireinstrumentation. The spec access function takes as input the memory locationreferred in the memory access instruction and a pointer to the signature generatorfunction. Passing a pointer to the signature generator provides users with the flexibilityto choose customized functions that are specific to each parallel program. Thisin turn enables SPECCROSS to achieve low conflict rate across programs with differingmemory access patterns.67

1. Initialization. The init function performs initialization by setting up bookkeepingdata structures, including allocating memory for signatures, the epoch number,and the task number. In speculation mode, init checkpoints the program beforebeginning parallel execution.2. Thread Creation. The create threads function spawns new threads in bothprofiling and speculation modes. Unlike pthreads, a SPECCROSS thread’s stack isnot deallocated after the thread exits. This implementation detail is vital for checkpointingand recovery, because it allows a new thread to reclaim an old thread’s stack<strong>using</strong> longjmp.3. Barrier Entry. The enter barrier function increments the epoch number uponentry into a new epoch. In profiling mode or non-speculative mode, it executes thenon-speculative barrier. The parameter loop name is set to be the name of the loopheader basic block so that profiling could compute a minimum dependence distancefor each independent loop. While in speculation mode, it skips barrier synchronization.The enter barrier function is also responsible for periodically checkpointingspeculative state.4. Dependence Tracking. To compute the access signatures for each task, its memoryaccesses (loads and stores) are instrumented <strong>using</strong> the spec access function.Loads and stores need to be instrumented if they belong to different epochs and mayalias with each other. For typical programs, only a few memory accesses requireinstrumentation. The spec access function takes as input the memory locationreferred in the memory access instruction and a pointer to the signature generatorfunction. Passing a pointer to the signature generator provides users with the flexibilityto choose customized functions that are specific to each parallel program. Thisin turn enables SPECCROSS to achieve low conflict rate a<strong>cross</strong> programs with differingmemory access patterns.67

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

Saved successfully!

Ooh no, something went wrong!