automatically exploiting cross-invocation parallelism using runtime ...
automatically exploiting cross-invocation parallelism using runtime ... automatically exploiting cross-invocation parallelism using runtime ...
Main thread:main() {init();create_threads(threads, attrs, SpecCross_parallel_func, args);cleanup();}Worker thread:SpecCross_parallel_func(threadID) {for (t = 0; t < STEP; t++) {enter_barrier(threadID, "L1");L1: for (i = threadID; i < M; i = i + THREADNUM) {enter_task(threadID, minimum_distance_L1);spec_access(threadID, callback, &A[i], &C[i]);A[i] = do_work(B[C[i]]);exit_task(threadID);}enter_barrier(threadID, "L2");L2: for (j = threadID; j < M; j = j + THREADNUM) {enter_task(threadID, minimum_distance_L2);spec_access(threadID, callback, &C[D[j]], &A[j]);B[j] = do_work(A[D[j]]);exit_task(threadID);}}send_end_token(threadID);}Figure 4.9: Demonstration of using SPECCROSS runtime library in a parallel program5. Task Initialization. Function enter task is inserted before each task. It is notused in profiling mode.In speculation mode, it collects epoch number and tasknumber of worker threads other than the caller thread and sends the number pairsto the checker thread. The value of spec distance specifies the speculation distancebetween two tasks. This value is set according to the minimum distance returned bythe profiling run. The worker thread is stalled if it is executing beyond the minimumdistance compared to other worker threads.6. Task Finalization. Once a task completes execution, exit task is called. Inprofiling mode, this function logs the access signature of the task, compares this ac-68
cess signature with signatures of tasks executed by other threads in previous epochs.When detecting memory access conflicts, it records the dependence distance betweenpairs of conflicting tasks. After recording the minimum dependence distances betweenall conflicting tasks, it increments the task number. In speculation mode, itsimply increments the task number of the caller thread.7. Thread Completion. In speculation mode, after completing the execution of allepochs, function send end token sends an END TOKEN to the checker thread. Inprofiling mode, it does nothing.8. Enforcing Synchronization. Two functions, sync and checkpoint, can be insertedbefore any epoch to synchronize all threads or to do an extra checkpoint. Thisis useful when a certain epoch is known to cause conflicts or contain irreversible operations(e.g. I/O). Users can use sync to synchronize all threads before enteringthis epoch and do an extra checkpoint operation before starting the execution of thenext epoch.9. Speculation Finalization. Function cleanup is inserted at the end of the programwhich waits for worker threads and checker thread to exit and then frees memoryallocated for profiling or speculation.4.3 SPECCROSS Parallelizing CompilerSPECCROSS targets a code region composed of large amounts of parallel loop invocations.Often, such a code region is an outermost loop which contains multiple parallelizableinner loops. To locate these code regions, we analyze all hot loops within the sequentialprogram. A lot loop accounts for at least 10% of the overall execution time during the profilingrun. A hot loop is a candidate for SPECCROSS if it satisfies three conditions: first, theoutermost loop itself cannot be successfully parallelized by any parallelization technique69
- Page 32 and 33: example which cannot benefit from e
- Page 34 and 35: These techniques are referred to as
- Page 36 and 37: unnecessary overhead at runtime.Tab
- Page 38 and 39: Chapter 3Non-Speculatively Exploiti
- Page 40 and 41: for a variety of reasons. For insta
- Page 42 and 43: 12x11x10xDOMOREPthread Barrier9xLoo
- Page 44 and 45: Algorithm 1: Pseudo-code for schedu
- Page 46 and 47: Algorithm 2: Pseudo-code for worker
- Page 48 and 49: 3.3 Compiler ImplementationThe DOMO
- Page 50 and 51: to T i . DOMORE’s MTCG follows th
- Page 52 and 53: Outer_Preheaderbr BB1ABB1A:ind1 = P
- Page 54 and 55: Algorithm 3: Pseudo-code for genera
- Page 56 and 57: Scheduler Function SchedulerSync Fu
- Page 58 and 59: SchedulerWorker1 Worker2Worker3Work
- Page 60 and 61: 3.5 Related Work3.5.1 Cross-invocat
- Page 62 and 63: ations during the inspecting proces
- Page 64 and 65: for (t = 0; t < STEP; t++) {L1: for
- Page 66 and 67: sequential_func() {for (t = 0; t <
- Page 68 and 69: Workerthread 1Workerthread 2Workert
- Page 70 and 71: library provides efficient misspecu
- Page 72 and 73: Workerthread 1TimeFigure 4.6: Timin
- Page 74 and 75: 4.2 SPECCROSS Runtime System4.2.1 M
- Page 76 and 77: takes up to 200MB memory space.To d
- Page 78 and 79: checkpoint, the child spawns new wo
- Page 80 and 81: Operation DescriptionFunctions for
- Page 84 and 85: implemented in the Liberty parallel
- Page 86 and 87: Algorithm 5: Pseudo-code for SPECCR
- Page 88 and 89: CROSS, since SPECCROSS can be appli
- Page 90 and 91: techniques.Synchronization via sche
- Page 92 and 93: Source Benchmark Function % of exec
- Page 94 and 95: applied to the outermost loop, gene
- Page 96 and 97: 5.2 SPECCROSS Performance Evaluatio
- Page 98 and 99: and the number of checking requests
- Page 100 and 101: 8x7xno misspec.with misspec.Geomean
- Page 102 and 103: This thesisPrevious workSpeedup (x)
- Page 104 and 105: Program Speedup6x5x4x3x2xLOCALWRITE
- Page 106 and 107: for DOMORE and SPECCROSS. Others (e
- Page 108 and 109: programs and it achieves a geomean
- Page 110 and 111: Bibliography[1] R. Allen and K. Ken
- Page 112 and 113: [15] R. Cytron. DOACROSS: Beyond ve
- Page 114 and 115: [31] T. B. Jablin, Y. Zhang, J. A.
- Page 116 and 117: [47] A. Nicolau, G. Li, A. V. Veide
- Page 118 and 119: [62] L. Rauchwerger and D. Padua. T
- Page 120: national conference on Parallel Arc
cess signature with signatures of tasks executed by other threads in previous epochs.When detecting memory access conflicts, it records the dependence distance betweenpairs of conflicting tasks. After recording the minimum dependence distances betweenall conflicting tasks, it increments the task number. In speculation mode, itsimply increments the task number of the caller thread.7. Thread Completion. In speculation mode, after completing the execution of allepochs, function send end token sends an END TOKEN to the checker thread. Inprofiling mode, it does nothing.8. Enforcing Synchronization. Two functions, sync and checkpoint, can be insertedbefore any epoch to synchronize all threads or to do an extra checkpoint. Thisis useful when a certain epoch is known to cause conflicts or contain irreversible operations(e.g. I/O). Users can use sync to synchronize all threads before enteringthis epoch and do an extra checkpoint operation before starting the execution of thenext epoch.9. Speculation Finalization. Function cleanup is inserted at the end of the programwhich waits for worker threads and checker thread to exit and then frees memoryallocated for profiling or speculation.4.3 SPECCROSS Parallelizing CompilerSPECCROSS targets a code region composed of large amounts of parallel loop <strong>invocation</strong>s.Often, such a code region is an outermost loop which contains multiple parallelizableinner loops. To locate these code regions, we analyze all hot loops within the sequentialprogram. A lot loop accounts for at least 10% of the overall execution time during the profilingrun. A hot loop is a candidate for SPECCROSS if it satisfies three conditions: first, theoutermost loop itself cannot be successfully parallelized by any parallelization technique69