Title: Rollback by Reverse Computation
1Rollback byReverse Computation
- Kevin Hamlen
- CS717 Fault-Tolerant Computing
2Research onReversible Computation
- Quantum Computing
- Quantum Computation (Nielsen Chuang)
- Nanocomputers
- Ralph Merkle _at_ Zyvex (http//www.merkle.com)
- Low-power processor design
- http//www.ai.mit.edu/cvieri/reversible.html
- Computational Complexity Theory
- Time and Space Bounds for Reversible Simulation
(Buhrman, Tromp, and Vitányi) - Parallel Programs Fault Tolerance
- Carothers (RPI), Perumalla (Georgia Tech), and
Fujimoto (Georgia Tech)
3Georgia Tech Time Warp (GTW)
General purpose parallel discrete event
simulation executive
- General purpose simulator
- telecommunication network simulations
- commercial air traffic simulations
- Parallel
- Shared memory
- Message passing
- Event-based
- Each computation and each event associated with a
stimulus event - Executes programs written in C/C w/API calls
4Optimistic Synchronization
- Incorrect computations permitted
- Roll back when error detected
- Direct cancellation
5State-Saving
- Copy state-saving copy of entire state saved
before every event - Periodic state-saving copy of entire state
saved before every pth event - Incremental state-saving copy of only modified
state saved before every event - Reversible Computing copy of only destroyed
state data saved before every event
6Advantages of Reversible Computing
- Lower space overhead for saved state
- Lower time overhead in non-rollback case
- Cost of state-saving amortized over duration of
computation - Advantages most pronounced in fine-grained
settings (i.e. many events each associated with
small computations)
7Reversing C Programs
Original int x0, y1 f() if (xgty) y
x else x y
Reversible int x0, y1 bit b f() b
(xgty) if (b) y x else x y
Reverse int x0, y1 bit b rf() if (b)
y - x else x - y
Note If S is the state, then we need
rf(f(S))S. However we dont care about the
result of f(rf(S)).
8RCC Reverse C Compiler
- Transforms arbitrary C programs
- Each function made reversible
- A reverse of each function is generated
- GTW Executive modified to call function reverses
during rollback
9Saving Destroyed State DataThe Tape Driver
Abstraction
SAVE_BYTES(var) push var onto the tape and
increment the tape pointer by sizeof(var)8 RESTO
RE_BYTES(var) pop var from the tape and
decrement the tape pointer by sizeof(var)8 SAVE_
BITS(var, n) push the n low-order bits of var
onto the tape increment the tape pointer by
n RESTORE_BITS(var, n) pop n bits from the
tape and store them in the n low-order bits of
var decrement the tape pointer by n
10RCCs Transformation
Original int x0, y1 f() if (xgty) y
x else x y
Reversible int x0, y1 f() char
c!!(xgty) if (c) y x else x
y SAVE_BITS(c,1)
Reverse rf() char c RESTORE_BITS(c,1)
if (c) y - x else x - y
11RCC Compilation Procedure
Original C Program
Normalize
Transform
Optimize
Reversible C Program w/reverses
12Normalization Post-conditions
- Only one assignment per expression. No other
side-effects in such an expression except
possibly a single function call. - for() loops replaced by equivalent while()s.
- Conditional expressions are side-effect free.
- Only one return statement per function. It has
the form return or return var - breaks and continues replaced by gotos.
13Two Unusual Normalizations
- All floating point datatypes promoted to strictly
higher precision types - Software emulation of a new highest-precision
datatype may be necessary. - Abnormal exit (via goto) from a block requires
saving all variables which are about to go out of
scope. - Analogous to how C handles implicit destructor
calls
14Transformation PhaseBlock Scopes
Original int x, y s1 s2 s3
Reversible int x, y s1 s2 s3
SAVE(x) SAVE(y)
Reverse int x, y RESTORE(y)
RESTORE(x) rs3 rs2 rs1
15Interesting Transformations
- Function pointer calls maintain a hash table of
the reverses of functions - Labeled join points introduce a variable to
record the source of the jump - Loops introduce a counter variable to record
the number of iterations
16Optimization Phase
- Irreversible operations ignored (e.g. output,
network message sends) - Kernel-reversible operations are special cases
(e.g. message cancellation) - Dataflow analysis on reverses (esp. initializer
expressions) - Invariant detection (esp. conditionals)
- Tape compression (esp. loops)
17References
- C. Carothers, K. S. Perumalla, R. M. Fujimoto.
Efficient Optimistic Parallel Simulations using
Reverse Computation. In Proceedings of 13th
Workshop on Parallel and Distributed Simulation,
May 1999. - K.S. Perumalla and R. M. Fujimoto. Source code
transformations for efficient reversibility.
Technical Report, GIT-CC-99-21, College of
Computing, Georgia Institute of Technology.