Information-Flow Models for Shared Memory Allon Adir Hagit Attiya Gil Shurek.
-
Upload
rylee-bumpass -
Category
Documents
-
view
216 -
download
0
Transcript of Information-Flow Models for Shared Memory Allon Adir Hagit Attiya Gil Shurek.
Information-Flow Information-Flow Models for Shared Models for Shared
MemoryMemory
Allon AdirAllon Adir
Hagit AttiyaHagit Attiya
Gil ShurekGil Shurek
Final state: R2=2 ?
Prog1 Prog2
load(X, R1) load(Y, R3)
R2 := R1 R3 := R3 + 1
R1 := 1
store(R1, Y) store(R3, X)
Initial state: All=0
Program ExampleProgram Example
Prog1 Prog2
load(X, R1) load(Y, R3)
R2 := R1 R3 := R3 + 1
R1 := 1
store(R1, Y) store(R3, X)
Initial state: All=0
Final state: Y=R1=1, X=R2=R3=2
Program ExampleProgram Example
Final state: Y=R1=1, X=R2=R3=2
Prog1 Prog2
load(X, R1) load(Y, R3)
R2 := R1 R3 := R3 + 1
R1 := 1
store(R1, Y) store(R3, X)
Initial state: All=0
PowerPC ConsistencyPowerPC Consistency
Shared-Memory SemanticsShared-Memory Semantics
Capturing intricate shared-memory behaviors:SpeculationOut-of-Order ExecutionSynchronizationGranularity of Memory Accesses
Without revealing micro-architecture details
OutlineOutline
What is an Architecture?What is a Computation Model?The FrameworkSequential ConsistencyPowerPC Consistency
What is an "Architecture"?What is an "Architecture"?
Elements of an ArchitectureElements of an ArchitectureResources
GranulesStates
InstructionsFormatsOperands
Source/TargetAddressing-Mode
State Transformation
Elements of an ArchitectureElements of an ArchitectureProgram order
Computation ModelComputation ModelCan we reach final state s2 by running a program Prog from initial state s1?
Written as Is s1, s2, Progpossible?
Prog1 Prog2
store(R2, X)R1:=1 R2:=2 store(R1, X) store(R2, X)
Initial state: R1=R2=X=0
Final state: R1=1, R2=2, X=0 X=1 X=2
Example: Sequential ConsistencyExample: Sequential Consistency
load
store
store
mul
xor
load
Text O
rder
nand
branchcmp
Instruction instances + Text order
Flow-of-Information
Is the flow-of-information allowed by the model?
The FrameworkThe Framework
Resource X,R
Assignment resource-value pair (X,5)
Operation in-out pair ({(X,5)},{(R,5)})
Instruction ({(X,0)},{(R,0)}), ({(X,1)},{(R,1)}), ...
Program sequence of commands C1,...,Cm
Command an instruction B and a function
next: B [1..m]{}
The ElementsThe Elements
Program Order: ExampleProgram Order: Example
C1: load(X,R1)
C2: R3 := R1+R2
next(C1)=2
next(C2)=
op1: ({(X,1)},{(R1,1)})
op2: ({(R1,1),(R2,1)}, {(R3,2)})
s1: {(X,1), (R1,1), (R2,1), (R3,1)}
s2: {(X,1), (R1,1), (R2,1), (R3,2)}
Prog Instantiating Prog
Program order: s1 op1 op2 s2
Reads-From Mapping Reads-From Mapping
s1: All=1
load(X,R1)R3 := R1+R2
s2: R3=2, others=1
R1
R2
Reads-From Mapping Reads-From Mapping
s1: All=1
load(X,R1)R3 := R1+R2
s2: R3=2, others=1
R1
R2
R1
R2, X
R3
store(R2,X)store(R1,Y)
s1: All=0 s2 : All=1
load(X,R1) load(Y,R2)
The Reads-From Mapping is not CyclicThe Reads-From Mapping is not Cyclic
View orders View orders Order the operations in ProgOne for each Progi
Obey architecture-specific rules relating program-orderreads-from mapping
I(X)
s1
op3
s2op4op2op1
op5
< << <
(x)
O(X)
Sequential ExecutionSequential Execution
Information can not be read from the hidden past
s1
op3
s2op4op2op1
< << <
Sequential ExecutionSequential Execution
Information can not be read from the future
op5
Relative to which order?
Sequential ConsistencySequential ConsistencyS1,S2,Prog is sequentially consistent ifProg can be instantiated with a set of operations A and program order
A single view order linearextends the program order
Information flow satisfies the sequential execution conditions relative to view order
PowerPC ConsistencyPowerPC Consistency
Information flow satisfies the sequential execution conditionsRelative to program orderRelative to view orders
View orders enforce that
Memory is coherent, except for local stores.Shared resource dependencies are preserved.sync orders operations around it.sync is transitive (sort of…).Branch dependencies are preserved.
PowerPC Consistency: View OrdersPowerPC Consistency: View Orders
PowerPC Consistency: View Orders IPowerPC Consistency: View Orders I
PowerPC Consistency: View Orders IIPowerPC Consistency: View Orders II
Speculation is Visible to ProgramsSpeculation is Visible to Programs
Final state: X=Y=1R1=1,R2=0R3=1,R4=0
Initial state: All=0
Prog1 Prog2 Prog3 Prog4
load(X,R1) load(Y,R3) store(1,X) store(1,Y)sync syncload(Y,R2) load(X,R4)