Top Banner
Promising-ARM/RISC-V a simpler and faster operational concurrency model an equivalent simpler and faster presentation of ARMv8/RISC-V Christopher Pulte 1 Jean Pichon-Pharabod 1 Jeehoon Kang 2 Sung-Hwan Lee 3 Chung-Kil Hur 3 24 June 2019 1 University of Cambridge 2 Korea Advanced Institute of Science and Technology 3 Seoul National University
45

Promising-ARM/RISC-V - a simpler and faster operational ... · Promising-ARM/RISC-V a simpler and faster operational concurrency model an equivalent simpler and faster presentation

Jun 12, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Promising-ARM/RISC-V - a simpler and faster operational ... · Promising-ARM/RISC-V a simpler and faster operational concurrency model an equivalent simpler and faster presentation

Promising-ARM/RISC-Va simpler and faster operational concurrency modelan equivalent simpler and faster presentation of ARMv8/RISC-V

Christopher Pulte 1 Jean Pichon-Pharabod 1 Jeehoon Kang 2 Sung-Hwan Lee 3 Chung-Kil Hur 3

24 June 2019

1University of Cambridge

2Korea Advanced Institute of Science and Technology

3Seoul National University

Page 2: Promising-ARM/RISC-V - a simpler and faster operational ... · Promising-ARM/RISC-V a simpler and faster operational concurrency model an equivalent simpler and faster presentation

Concurrency programming

void produce(int v) {D = v;F = 1;

}

int consume() {while (1) {if (F) break;

}return D;

}

produce(42) ‖ d = consume()

Initially: D = F = 0Finally: d = 42

or: d = 0

compiler re-ordering,hardware out-of-orderexecution

re-ordering pastcontrol dependency

1

Page 3: Promising-ARM/RISC-V - a simpler and faster operational ... · Promising-ARM/RISC-V a simpler and faster operational concurrency model an equivalent simpler and faster presentation

Concurrency programming

void produce(int v) {D = v;F = 1;

}

int consume() {while (1) {if (F) break;

}return D;

}

produce(42) ‖ d = consume()

Initially: D = F = 0Finally: d = 42

or: d = 0

compiler re-ordering,hardware out-of-orderexecution

re-ordering pastcontrol dependency

1

Page 4: Promising-ARM/RISC-V - a simpler and faster operational ... · Promising-ARM/RISC-V a simpler and faster operational concurrency model an equivalent simpler and faster presentation

Concurrency programming

void produce(int v) {D = v;F[rel] = 1;

}

int consume() {while (1) {if (F[acq]) break;

}return D;

}

produce(42) ‖ d = consume()

Initially: D = F = 0Finally: d = 42

or: d = 0

compiler re-ordering,hardware out-of-orderexecution

re-ordering pastcontrol dependency

1

Page 5: Promising-ARM/RISC-V - a simpler and faster operational ... · Promising-ARM/RISC-V a simpler and faster operational concurrency model an equivalent simpler and faster presentation

Concurrency programming

void produce(int v) {D = v;F[rel] = 1;

}

int consume() {while (1) {if (F[acq]) break;

}return D;

}

produce(42) ‖ d = consume()

Need precise, simple semanticsand tool support.

1

Page 6: Promising-ARM/RISC-V - a simpler and faster operational ... · Promising-ARM/RISC-V a simpler and faster operational concurrency model an equivalent simpler and faster presentation

ARMv8/RISC-V concurrency

Axiomatic• o�cial reference model+ abstract, concise- not incremental: global axioms

Flat operational• proved equivalent+ incremental+ ISA, mixed-size support+ closer relation to H/W- complex

Promising-ARM/RISC-V inspired by Promising C11 [Kang et al]+ simple, incremental+ Coq equivalence proof with Axiomatic (excl. ISA model)+ ISA support- no mixed-size support yet+ fast enough for checking data structure examples

2

Page 7: Promising-ARM/RISC-V - a simpler and faster operational ... · Promising-ARM/RISC-V a simpler and faster operational concurrency model an equivalent simpler and faster presentation

ARMv8/RISC-V concurrency

Axiomatic• o�cial reference model+ abstract, concise- not incremental: global axioms

Flat operational• proved equivalent+ incremental+ ISA, mixed-size support+ closer relation to H/W- complex

Promising-ARM/RISC-V inspired by Promising C11 [Kang et al]+ simple, incremental+ Coq equivalence proof with Axiomatic (excl. ISA model)+ ISA support- no mixed-size support yet+ fast enough for checking data structure examples

2

Page 8: Promising-ARM/RISC-V - a simpler and faster operational ... · Promising-ARM/RISC-V a simpler and faster operational concurrency model an equivalent simpler and faster presentation

Model overview

Page 9: Promising-ARM/RISC-V - a simpler and faster operational ... · Promising-ARM/RISC-V a simpler and faster operational concurrency model an equivalent simpler and faster presentation

Out-of-order readsIdea 1: out-of-order read executionby reading from message history

T1store D := 42store F := 1

T2r1 = load F //reads 1if (r1 == 1) then

r2 = load D //reads 0else

..

T1.regs: . . .T1.promises: . . .

. . .

T2.regs:T2.promises: . . .

. . .

memory:

3

Page 10: Promising-ARM/RISC-V - a simpler and faster operational ... · Promising-ARM/RISC-V a simpler and faster operational concurrency model an equivalent simpler and faster presentation

Out-of-order readsIdea 1: out-of-order read executionby reading from message history

T1store D := 42store F := 1

T2r1 = load F //reads 1if (r1 == 1) then

r2 = load D //reads 0else

..

T1.regs: . . .T1.promises: . . .

. . .

T2.regs: r1 7→ 0@0, r2 7→ 0@0 . . .T2.promises: . . .

. . .

memory: (init)@0 3

Page 11: Promising-ARM/RISC-V - a simpler and faster operational ... · Promising-ARM/RISC-V a simpler and faster operational concurrency model an equivalent simpler and faster presentation

Out-of-order readsIdea 1: out-of-order read executionby reading from message history

T1store D := 42store F := 1

T2r1 = load F //reads 1if (r1 == 1) then

r2 = load D //reads 0else

..

T1.regs: . . .T1.promises: . . .

. . .

T2.regs: r1 7→ 0@0, r2 7→ 0@0 . . .T2.promises: . . .

. . .

memory: (init)@0, (D = 42)@1 3

Page 12: Promising-ARM/RISC-V - a simpler and faster operational ... · Promising-ARM/RISC-V a simpler and faster operational concurrency model an equivalent simpler and faster presentation

Out-of-order readsIdea 1: out-of-order read executionby reading from message history

T1store D := 42store F := 1

T2r1 = load F //reads 1if (r1 == 1) then

r2 = load D //reads 0else

..

T1.regs: . . .T1.promises: . . .

. . .

T2.regs: r1 7→ 0@0, r2 7→ 0@0 . . .T2.promises: . . .

. . .

memory: (init)@0, (D = 42)@1, (F = 1)@2 3

Page 13: Promising-ARM/RISC-V - a simpler and faster operational ... · Promising-ARM/RISC-V a simpler and faster operational concurrency model an equivalent simpler and faster presentation

Out-of-order readsIdea 1: out-of-order read executionby reading from message history

T1store D := 42store F := 1

T2r1 = load F //reads 1if (r1 == 1) then

r2 = load D //reads 0else

..

T1.regs: . . .T1.promises: . . .

. . .

T2.regs: r1 7→ 1@0, r2 7→ 0@0 . . .T2.promises: . . .

. . .

memory: (init)@0, (D = 42)@1, (F = 1)@2 3

Page 14: Promising-ARM/RISC-V - a simpler and faster operational ... · Promising-ARM/RISC-V a simpler and faster operational concurrency model an equivalent simpler and faster presentation

Out-of-order readsIdea 1: out-of-order read executionby reading from message history

T1store D := 42store F := 1

T2r1 = load F //reads 1if (r1 == 1) then

r2 = load D //reads 0else

..

T1.regs: . . .T1.promises: . . .

. . .

T2.regs: r1 7→ 1@0, r2 7→ 0@0 . . .T2.promises: . . .

. . .

memory: (init)@0, (D = 42)@1, (F = 1)@2 3

Page 15: Promising-ARM/RISC-V - a simpler and faster operational ... · Promising-ARM/RISC-V a simpler and faster operational concurrency model an equivalent simpler and faster presentation

Out-of-order readsIdea 1: out-of-order read executionby reading from message history

T1store D := 42store F := 1

T2r1 = load F //reads 1if (r1 == 1) then

r2 = load D //reads 0else

..

T1.regs: . . .T1.promises: . . .

. . .

T2.regs: r1 7→ 1@0, r2 7→ 0@0 . . .T2.promises: . . .

. . .

memory: (init)@0, (D = 42)@1, (F = 1)@2 3

Page 16: Promising-ARM/RISC-V - a simpler and faster operational ... · Promising-ARM/RISC-V a simpler and faster operational concurrency model an equivalent simpler and faster presentation

Out-of-order readsIdea 1: out-of-order read executionby reading from message history

T1store D := 42store F := 1

T2r1 = load F //reads 1if (r1 == 1) then

r2 = load D //reads 0else

..

T1.regs: . . .T1.promises: . . .

. . .

T2.regs: r1 7→ 1@0, r2 7→ 0@0 . . .T2.promises: . . .

. . .

memory: (init)@0, (D = 42)@1, (F = 1)@2 3

Page 17: Promising-ARM/RISC-V - a simpler and faster operational ... · Promising-ARM/RISC-V a simpler and faster operational concurrency model an equivalent simpler and faster presentation

Out-of-order readsIdea 2: ordering reads with views.A view is a timestamp of a “seen” write.

regstate: Reg 7→ Val × View

address dependency

T1store D := 42store F := 1

T2r1 = load F //reads 1if (r1 == 1) then

r2 = load (D+r1-r1) //reads 0else

..

T1.regs: . . .T1.promises: . . .

. . .

T2.regs:T2.promises: . . .

. . .

memory:

4

Page 18: Promising-ARM/RISC-V - a simpler and faster operational ... · Promising-ARM/RISC-V a simpler and faster operational concurrency model an equivalent simpler and faster presentation

Out-of-order readsIdea 2: ordering reads with views.A view is a timestamp of a “seen” write.

regstate: Reg 7→ Val × View

T1store D := 42store F := 1

T2r1 = load F //reads 1if (r1 == 1) then

r2 = load (D+r1-r1) //reads 0else

..

T1.regs: . . .T1.promises: . . .

. . .

T2.regs: r1 7→ 0@0, r2 7→ 0@0 . . .T2.promises: . . .

. . .

memory: (init)@0, (D = 42)@1, (F = 1)@24

Page 19: Promising-ARM/RISC-V - a simpler and faster operational ... · Promising-ARM/RISC-V a simpler and faster operational concurrency model an equivalent simpler and faster presentation

Out-of-order readsIdea 2: ordering reads with views.A view is a timestamp of a “seen” write.

regstate: Reg 7→ Val × View

T1store D := 42store F := 1

T2r1 = load F //reads 1if (r1 == 1) then

r2 = load (D+r1-r1) //reads 0else

..

T1.regs: . . .T1.promises: . . .

. . .

T2.regs: r1 7→ 0@0, r2 7→ 0@0 . . .T2.promises: . . .

. . .

memory: (init)@0, (D = 42)@1, (F = 1)@24

Page 20: Promising-ARM/RISC-V - a simpler and faster operational ... · Promising-ARM/RISC-V a simpler and faster operational concurrency model an equivalent simpler and faster presentation

Out-of-order readsIdea 2: ordering reads with views.A view is a timestamp of a “seen” write.

regstate: Reg 7→ Val × View

T1store D := 42store F := 1

T2r1 = load F //reads 1if (r1 == 1) then

r2 = load (D+r1-r1) //reads 0else

..

T1.regs: . . .T1.promises: . . .

. . .

T2.regs: r1 7→ 1@2, r2 7→ 0@0 . . .T2.promises: . . .

. . .

memory: (init)@0, (D = 42)@1, (F = 1)@24

Page 21: Promising-ARM/RISC-V - a simpler and faster operational ... · Promising-ARM/RISC-V a simpler and faster operational concurrency model an equivalent simpler and faster presentation

Out-of-order readsIdea 2: ordering reads with views.A view is a timestamp of a “seen” write.

regstate: Reg 7→ Val × View

T1store D := 42store F := 1

T2r1 = load F //reads 1if (r1 == 1) then

r2 = load (D+r1-r1) //reads 0else

..

T1.regs: . . .T1.promises: . . .

. . .

T2.regs: r1 7→ 1@2, r2 7→ 0@0 . . .T2.promises: . . .

. . .

memory: (init)@0, (D = 42)@1, (F = 1)@24

Page 22: Promising-ARM/RISC-V - a simpler and faster operational ... · Promising-ARM/RISC-V a simpler and faster operational concurrency model an equivalent simpler and faster presentation

Out-of-order readsIdea 2: ordering reads with views.A view is a timestamp of a “seen” write.

regstate: Reg 7→ Val × View

T1store D := 42store F := 1

T2r1 = load F //reads 1if (r1 == 1) then

r2 = load (D+r1-r1) //reads 0else

..

T1.regs: . . .T1.promises: . . .

. . .

T2.regs: r1 7→ 1@2, r2 7→ 0@0 . . .T2.promises: . . .

. . .

memory: (init)@0, (D = 42)@1, (F = 1)@24

Page 23: Promising-ARM/RISC-V - a simpler and faster operational ... · Promising-ARM/RISC-V a simpler and faster operational concurrency model an equivalent simpler and faster presentation

Out-of-order writesIdea 3: out-of-order writes with promises.A thread can promise any write at any time,if it can later ful�l the promise.

T1store D := 42store F := 1

T2r1 = load F //reads 1if (r1 == 1) then

r2 = load (D+r1-r1) //reads 0else

..

T1.regs: . . .T1.promises:

. . .

T2.regs:T2.promises: ∅

. . .

memory:

5

Page 24: Promising-ARM/RISC-V - a simpler and faster operational ... · Promising-ARM/RISC-V a simpler and faster operational concurrency model an equivalent simpler and faster presentation

Out-of-order writesIdea 3: out-of-order writes with promises.A thread can promise any write at any time,if it can later ful�l the promise.

T1store D := 42store F := 1

T2r1 = load F //reads 1if (r1 == 1) then

r2 = load (D+r1-r1) //reads 0else

..

T1.regs: . . .T1.promises: ∅

. . .

T2.regs: r1 7→ 0@0, r2 7→ 0@0 . . .T2.promises: ∅

. . .

memory: (init)@05

Page 25: Promising-ARM/RISC-V - a simpler and faster operational ... · Promising-ARM/RISC-V a simpler and faster operational concurrency model an equivalent simpler and faster presentation

Out-of-order writesIdea 3: out-of-order writes with promises.A thread can promise any write at any time,if it can later ful�l the promise.

T1store D := 42store F := 1

T2r1 = load F //reads 1if (r1 == 1) then

r2 = load (D+r1-r1) //reads 0else

..

T1.regs: . . .T1.promises: (F = 1)@1

. . .

T2.regs: r1 7→ 0@0, r2 7→ 0@0 . . .T2.promises: ∅

. . .

memory: (init)@0, (F = 1)@15

Page 26: Promising-ARM/RISC-V - a simpler and faster operational ... · Promising-ARM/RISC-V a simpler and faster operational concurrency model an equivalent simpler and faster presentation

Out-of-order writesIdea 3: out-of-order writes with promises.A thread can promise any write at any time,if it can later ful�l the promise.

T1store D := 42store F := 1

T2r1 = load F //reads 1if (r1 == 1) then

r2 = load (D+r1-r1) //reads 0else

..

T1.regs: . . .T1.promises: (F = 1)@1

. . .

T2.regs: r1 7→ 0@0, r2 7→ 0@0 . . .T2.promises: ∅

. . .

memory: (init)@0, (F = 1)@1, (D = 42)@25

Page 27: Promising-ARM/RISC-V - a simpler and faster operational ... · Promising-ARM/RISC-V a simpler and faster operational concurrency model an equivalent simpler and faster presentation

Out-of-order writesIdea 3: out-of-order writes with promises.A thread can promise any write at any time,if it can later ful�l the promise.

T1store D := 42store F := 1

T2r1 = load F //reads 1if (r1 == 1) then

r2 = load (D+r1-r1) //reads 0else

..

T1.regs: . . .T1.promises: ∅

. . .

T2.regs: r1 7→ 0@0, r2 7→ 0@0 . . .T2.promises: ∅

. . .

memory: (init)@0, (F = 1)@1, (D = 42)@25

Page 28: Promising-ARM/RISC-V - a simpler and faster operational ... · Promising-ARM/RISC-V a simpler and faster operational concurrency model an equivalent simpler and faster presentation

Out-of-order writesIdea 3: out-of-order writes with promises.A thread can promise any write at any time,if it can later ful�l the promise.

T1store D := 42store F := 1

T2r1 = load F //reads 1if (r1 == 1) then

r2 = load (D+r1-r1) //reads 0else

..

T1.regs: . . .T1.promises: ∅

. . .

T2.regs: r1 7→ 1@1, r2 7→ 0@0 . . .T2.promises: ∅

. . .

memory: (init)@0, (F = 1)@1, (D = 42)@25

Page 29: Promising-ARM/RISC-V - a simpler and faster operational ... · Promising-ARM/RISC-V a simpler and faster operational concurrency model an equivalent simpler and faster presentation

Out-of-order writesIdea 3: out-of-order writes with promises.A thread can promise any write at any time,if it can later ful�l the promise.

T1store D := 42store F := 1

T2r1 = load F //reads 1if (r1 == 1) then

r2 = load (D+r1-r1) //reads 0else

..

T1.regs: . . .T1.promises: ∅

. . .

T2.regs: r1 7→ 1@1, r2 7→ 0@0 . . .T2.promises: ∅

. . .

memory: (init)@0, (F = 1)@1, (D = 42)@25

Page 30: Promising-ARM/RISC-V - a simpler and faster operational ... · Promising-ARM/RISC-V a simpler and faster operational concurrency model an equivalent simpler and faster presentation

Model details

Full model details include

• write ordering: with views T.vwm, T.vwp

• certi�cation: thread-locally preventexecutions with unful�lled promises

• coherence T.coh

• write forwarding T.fwdb

• barriers, release/acquire: uniformly with views T.vrm, T.vrp, T.vwm, T.vwp, T.vrel• load/store exclusive instructions T.exclb

6

Page 31: Promising-ARM/RISC-V - a simpler and faster operational ... · Promising-ARM/RISC-V a simpler and faster operational concurrency model an equivalent simpler and faster presentation

Executable tool

Page 32: Promising-ARM/RISC-V - a simpler and faster operational ... · Promising-ARM/RISC-V a simpler and faster operational concurrency model an equivalent simpler and faster presentation

Executable tool

Executable tool for interactive and exhaustive executionof ARMv8 or RISC-V concurrent assembly programs.

Building on Sail, Sail ISA models, rmem[Sarkar et al 2011/12, Gray et al 2015, Flur et al 2016/17, Pulte et al 2018, Armstrong et al 2019]

• exhaustively: enumerate all possible �nal states allowed by model,each with witnessing trace

• interactively: interactively replay witnessing trace for debugging

7

Page 33: Promising-ARM/RISC-V - a simpler and faster operational ... · Promising-ARM/RISC-V a simpler and faster operational concurrency model an equivalent simpler and faster presentation

Executable tool

Optimisation 1: promises �rst (optimisation proved in Coq)

For every trace tr, there is anequivalent trace tr′ s.th:

tr′ = _ t1−→ _ t2−→ _ t3−→ _ . . .︸ ︷︷ ︸promise

_ tn−→ _ tn+1−→ _ tn+2−→ _ . . .︸ ︷︷ ︸non−promise

Optimisation 2: explore �nal thread states in parallel

8

Page 34: Promising-ARM/RISC-V - a simpler and faster operational ... · Promising-ARM/RISC-V a simpler and faster operational concurrency model an equivalent simpler and faster presentation

Executable tool

Run text book concurrent data structure/lock implementations:

1. write data structure in C++ or Rustwrite test code, testing operations and logging data

2. compile with gcc/llvm -O3 to ARMv8 assembly,map assembly into litmus format with script

3. run tool to enumerate �nal states

9

Page 35: Promising-ARM/RISC-V - a simpler and faster operational ... · Promising-ARM/RISC-V a simpler and faster operational concurrency model an equivalent simpler and faster presentation

Examples

• spinlock variants in C++ and Rust

• single-producer-single-consumercircular queue

• single-producer-multiple-consumercircular queue

• ticket lock

• treiber stack in C++ and Rustvariants

• Chase-Lev dequeue

• Michael & Scott queue

10

Page 36: Promising-ARM/RISC-V - a simpler and faster operational ... · Promising-ARM/RISC-V a simpler and faster operational concurrency model an equivalent simpler and faster presentation

EvaluationTest Promising Flat

Linux Spinlock (asm)-7 0.61 9108.53Linux Spinlock (cpp)-3 6.58 1472.74Linux Spinlock (Rust)-3 4.88 52.52Single-producer-single-consumer-3-3 1.36 249.26Single-producer-multiple-consumers-3-3-3 71.12 ooTTicket lock/(opt)-3 18.08 / 20.13 ooT / ooTTreiber stack (cpp)/(opt)-100-010-010 0.42 / 0.42 2144.52 / 5943.50Treiber stack (cpp)/(opt)-100-100-010 8.70 / 8.70 ooT / ooTTreiber stack (cpp)/(opt)-210-011-000 615.41 / 637.98 ooT / ooTTreiber stack (Rust)-100-010-010 0.39 77.21Treiber stack (Rust)-100-100-010 7.30 8940.03Treiber stack (Rust)-210-011-000 522.19 ooTChase-Lev dequeue/(opt)-100-1-0 0.30 / 0.30 2.93 / 2.97Chase-Lev dequeue/(opt)-110-1-0 0.44 / 0.44 1042.88 / 1114.39Chase-Lev dequeue/(opt)-211-2-1 28.55 / 111.54 ooT / ooTChase-Lev dequeue/(opt)-100-000-000 1.34 / 2.95 2983.11 / ooTChase-Lev dequeue/(opt)-100-010-000 2.55 / 5.66 ooT / ooTChase-Lev dequeue/(opt)-110-100-010 2108.12 / ooT ooT / ooT

ooT: out of time11

Page 37: Promising-ARM/RISC-V - a simpler and faster operational ... · Promising-ARM/RISC-V a simpler and faster operational concurrency model an equivalent simpler and faster presentation

Conclusion

Promising-ARM/RISC-V:

• simpler operational concurrency model• interactive checking and debugging tool• promising performance results

Promising and other rmem models:https://github.com/rems-project/rmem

Sail and Sail models:https://github.com/rems-project/sail

try model in online interface:https://www.cl.cam.ac.uk/~pes20/rmem

12

Page 38: Promising-ARM/RISC-V - a simpler and faster operational ... · Promising-ARM/RISC-V a simpler and faster operational concurrency model an equivalent simpler and faster presentation

Thank you

13

Page 39: Promising-ARM/RISC-V - a simpler and faster operational ... · Promising-ARM/RISC-V a simpler and faster operational concurrency model an equivalent simpler and faster presentation

Why ARMv8/RISC-V?

C/C++ Rust Java Linux

x86 ARM RISC-V Power

Language concurrency models:no accepted thin-air free semantics

Machine concurrency models:better understood,compiler-independent toolsthat support hand-written assembly

ARMv8: widely used, subtle concurrency semanticsRISC-V: recently adopted similar model

14

Page 40: Promising-ARM/RISC-V - a simpler and faster operational ... · Promising-ARM/RISC-V a simpler and faster operational concurrency model an equivalent simpler and faster presentation

Out-of-order writesWrite ordering with views

T1store D := 42store[rel] F := 1

T2r1 = load F //reads 1if (r1 == 1) then

r2 = load (D+r1-r1) //reads 0else

..

T1.regs: . . .T1.promises:

T1.vwm:. . .

T2.regs: . . .T2.promises: . . .

T2.vwm: . . .. . .

memory:

15

Page 41: Promising-ARM/RISC-V - a simpler and faster operational ... · Promising-ARM/RISC-V a simpler and faster operational concurrency model an equivalent simpler and faster presentation

Out-of-order writesWrite ordering with views

T1store D := 42store[rel] F := 1

T2r1 = load F //reads 1if (r1 == 1) then

r2 = load (D+r1-r1) //reads 0else

..

T1.regs: . . .T1.promises: ∅

T1.vwm: 0. . .

T2.regs: . . .T2.promises: . . .

T2.vwm: . . .. . .

memory: (init)@0 15

Page 42: Promising-ARM/RISC-V - a simpler and faster operational ... · Promising-ARM/RISC-V a simpler and faster operational concurrency model an equivalent simpler and faster presentation

Out-of-order writesWrite ordering with views

T1store D := 42store[rel] F := 1

T2r1 = load F //reads 1if (r1 == 1) then

r2 = load (D+r1-r1) //reads 0else

..

T1.regs: . . .T1.promises: (F = 1)@1

T1.vwm: 0. . .

T2.regs: . . .T2.promises: . . .

T2.vwm: . . .. . .

memory: (init)@0, (F = 1)@1 15

Page 43: Promising-ARM/RISC-V - a simpler and faster operational ... · Promising-ARM/RISC-V a simpler and faster operational concurrency model an equivalent simpler and faster presentation

Out-of-order writesWrite ordering with views

T1store D := 42store[rel] F := 1

T2r1 = load F //reads 1if (r1 == 1) then

r2 = load (D+r1-r1) //reads 0else

..

T1.regs: . . .T1.promises: (F = 1)@1

T1.vwm: 2. . .

T2.regs: . . .T2.promises: . . .

T2.vwm: . . .. . .

memory: (init)@0, (F = 1)@1, (D = 42)@2 15

Page 44: Promising-ARM/RISC-V - a simpler and faster operational ... · Promising-ARM/RISC-V a simpler and faster operational concurrency model an equivalent simpler and faster presentation

Out-of-order writesWrite ordering with views

T1store D := 42store[rel] F := 1

T2r1 = load F //reads 1if (r1 == 1) then

r2 = load (D+r1-r1) //reads 0else

..

T1.regs: . . .T1.promises: (F = 1)@1

T1.vwm: 2. . .

T2.regs: . . .T2.promises: . . .

T2.vwm: . . .. . .

memory: (init)@0, (F = 1)@1, (D = 42)@2 15

Page 45: Promising-ARM/RISC-V - a simpler and faster operational ... · Promising-ARM/RISC-V a simpler and faster operational concurrency model an equivalent simpler and faster presentation

Prevent executions with unful�lled promiseswith certi�cation.

For every step by thread T, do simple thread-local check: ensurethere exists trace by T executing in program-order,alone, under current memory ful�lling all its promises.

16