structuring instruction-sets with higher-order functions

165
Structuring instruction-sets with higher-order functions Byron Cook Advisor: John Launchbury

Upload: sutton

Post on 31-Jan-2016

44 views

Category:

Documents


0 download

DESCRIPTION

Structuring instruction-sets with higher-order functions. Byron Cook Advisor: John Launchbury. Microprocessor correctness. ISA: Simple machine. Lots of microarchitectural tricks. Microprocessor correctness. Speculative. Out-of-order. Superscalar. Pipelined. Microprocessor correctness. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Structuring instruction-sets with higher-order functions

Structuring instruction-sets with higher-order functions

Byron Cook

Advisor: John Launchbury

Page 2: Structuring instruction-sets with higher-order functions

2

Microprocessor correctness

Lots of microarchitectural tricks

ISA: Simple machine

Page 3: Structuring instruction-sets with higher-order functions

3

Microprocessor correctness

Pipelined.

Superscalar.

Out-of-order.

Speculative.

Page 4: Structuring instruction-sets with higher-order functions

4

Microprocessor correctness

?

Page 5: Structuring instruction-sets with higher-order functions

5

FV for microprocessor correctness

Approach to improving microprocessor quality: Model the systems in logic Prove that the microarchitecture

implements the ISA. Rich mixtures of automatic and manual

proof strategies are common.

Page 6: Structuring instruction-sets with higher-order functions

6

FV for microprocessor correctness

Research community has found many techniques to solve this problem.

Several papers prove correctness of “superscalar, out-of-order, and speculative” implementations of RISC ISAs.

Page 7: Structuring instruction-sets with higher-order functions

7

The twist: ISAs are evolving

Domain-specific extensions. example: MMX

Predication. example: ARM

Concurrency instructions: Example: IA-64

Speculative instructions: Example: IA-64

Page 8: Structuring instruction-sets with higher-order functions

8

The twist: ISAs are evolving

Page 9: Structuring instruction-sets with higher-order functions

9

The twist: ISAs are evolving

Page 10: Structuring instruction-sets with higher-order functions

10

The twist: ISAs are evolving

Extra structure to leverage

Page 11: Structuring instruction-sets with higher-order functions

11

The twist: ISAs are evolving

Should be carefully presented

Page 12: Structuring instruction-sets with higher-order functions

12

The twist: ISAs are evolving

Opportunity for new axis of proof decomposition: MMX: Can we first prove that the MMX

execution unit correctly implements MMX Predication: Can we prove just the MA

predication machinery correct? Concurrency instructions: Can we abstract

over the underlying pipelines? Speculative instructions: …………

Page 13: Structuring instruction-sets with higher-order functions

13

Question that the dissertation answers

Can higher-order functions help?

Facilitate architectural extension design?

Microarchitectural modeling of extensions?

Facilitate the correctness proof?

Page 14: Structuring instruction-sets with higher-order functions

14

Overview

Background Extensions and higher-order

functions Conclusion

Page 15: Structuring instruction-sets with higher-order functions

15

Overview

Background Extensions and higher-order

functions Conclusion

Page 16: Structuring instruction-sets with higher-order functions

16

Overview

Background Models and specifications Correctness Formal verification techniques

Extensions and higher-order functions

Conclusion

Page 17: Structuring instruction-sets with higher-order functions

17

Models and specifications

In the literature: transition systems are used.

A transition system is a structure with: A set of initial states. A next state relation. An “observation” function.

Page 18: Structuring instruction-sets with higher-order functions

18

Models and specifications

Let’s see an example………

Page 19: Structuring instruction-sets with higher-order functions

19

Models and specifications

Page 20: Structuring instruction-sets with higher-order functions

20

Models and specifications

Page 21: Structuring instruction-sets with higher-order functions

21

Models and specifications

Page 22: Structuring instruction-sets with higher-order functions

22

Models and specifications

Page 23: Structuring instruction-sets with higher-order functions

23

Models and specifications

t = (init,next,obs)

init represents the initial states: init :: {s}

next represents the next state relation: next :: i -> s -> {s}

obs is the observation function:obs :: s -> o

Page 24: Structuring instruction-sets with higher-order functions

24

Models and specifications

type TS i s o = ( {s} , i->s->{s} , s->o )

t :: TS i s o

t = (init,next,obs)

Page 25: Structuring instruction-sets with higher-order functions

25

Models and specifications

{s} can sometimes mean a finite set of elements of s.

Sometimes infinite sets are used.

Sometimes, sets are not used at all.

Page 26: Structuring instruction-sets with higher-order functions

26

Models and specifications

type TS c i s o = ( c s , i->s->c s , s->o )

Page 27: Structuring instruction-sets with higher-order functions

27

Models and specifications

Finite sets t :: TS FSet i s o. t :: ( FSet s , i->s->FSet s , s->o )

Infinite sets: t :: TS Set i s o. t :: ( Set s , i->s->Set s , s->o )

No sets: t :: TS Id i s o. t :: ( s , i->s->s , s->o )

Page 28: Structuring instruction-sets with higher-order functions

28

Models and specifications

data OPCODE = ADD Reg Reg Reg

| SUB Reg Reg Reg

.

.

Example:ADD r1 r2 r5 :: OPCODE

Page 29: Structuring instruction-sets with higher-order functions

29

Example: An ISA specification

risc :: TS FSet

OPCODE

RegFile

(Obs RegFile)

risc = (risc_init,risc_next,risc_obs)

where risc_init = unit i_rf

risc_next instr state = ………

risc_obs s = ………

Page 30: Structuring instruction-sets with higher-order functions

30

Models and specifications

data Obs x = Ready x

| Busy

| Stalled

Page 31: Structuring instruction-sets with higher-order functions

31

Example: A pipelined model

pipe :: TS FSet OPCODE (RegFile,PipeReg,PipeReg,PipeReg)

(Obs RegFile)

pipe = (pipe_init,pipe_next,pipe_obs)where pipe_init = unit (i_rf,empty,empty,empty) pipe_next instr (rf,r1,r2,r3) = ……… pipe_obs (rf,r1,r2,r3) = ………

Page 32: Structuring instruction-sets with higher-order functions

32

Overview

Background Models and specifications Correctness Formal verification techniques

Extensions and higher-order functions

Conclusion

Page 33: Structuring instruction-sets with higher-order functions

33

What is correctness?

nm ?

Page 34: Structuring instruction-sets with higher-order functions

34

What is correctness?

Often a preorder relationship:

Bisimulation (BISIM).

Simulation (SIM).

Flush-point correctness (FP).

Page 35: Structuring instruction-sets with higher-order functions

35

What is simulation?

“m” is the implementation, “n” is the specification.There exists an R such that

Page 36: Structuring instruction-sets with higher-order functions

36

What is simulation?

init m

“m” is the implementation, “n” is the specification.There exists an R such that

Page 37: Structuring instruction-sets with higher-order functions

37

What is simulation?

init n

init m

“m” is the implementation, “n” is the specification.There exists an R such that

Page 38: Structuring instruction-sets with higher-order functions

38

What is simulation?

init n

init m

R

“m” is the implementation, “n” is the specification.There exists an R such that

Page 39: Structuring instruction-sets with higher-order functions

39

What is simulation?

init n

init m

R

next m i

R

“m” is the implementation, “n” is the specification.There exists an R such that

Page 40: Structuring instruction-sets with higher-order functions

40

What is simulation?

init n

init m

R

next n i

next m i

R

“m” is the implementation, “n” is the specification.There exists an R such that

Page 41: Structuring instruction-sets with higher-order functions

41

What is simulation?

init n

init m

R

next n i

next m i

RR

“m” is the implementation, “n” is the specification.There exists an R such that

Page 42: Structuring instruction-sets with higher-order functions

42

What is simulation?

init n

init m

R

next n i

next m i

RR R

“m” is the implementation, “n” is the specification.There exists an R such that

Page 43: Structuring instruction-sets with higher-order functions

43

What is simulation?

init n

init m

R

next n i

next m i

RR R

obs n

obs m

“m” is the implementation, “n” is the specification.There exists an R such that

Page 44: Structuring instruction-sets with higher-order functions

44

What is simulation?

(m,n)SIM iff R. ainit m, binit n. (a,b)R (a,b)R, i, a’next m i a. b’next n i

b and (a’,b’)R (a,b)R. obs m a = obs n b

Page 45: Structuring instruction-sets with higher-order functions

45

What is bisimulation?

“m” is the implementation, “n” is the specification.There exists an R such that, the same as before AND:

Page 46: Structuring instruction-sets with higher-order functions

46

What is bisimulation?

init n

“m” is the implementation, “n” is the specification.There exists an R such that, the same as before AND:

Page 47: Structuring instruction-sets with higher-order functions

47

What is bisimulation?

init n

init m

“m” is the implementation, “n” is the specification.There exists an R such that, the same as before AND:

Page 48: Structuring instruction-sets with higher-order functions

48

What is bisimulation?

init n

init m

R

“m” is the implementation, “n” is the specification.There exists an R such that, the same as before AND:

Page 49: Structuring instruction-sets with higher-order functions

49

What is bisimulation?

init n

init m

R

next n i

R

“m” is the implementation, “n” is the specification.There exists an R such that, the same as before AND:

Page 50: Structuring instruction-sets with higher-order functions

50

What is bisimulation?

init n

init m

R

next n i

next m i

R

“m” is the implementation, “n” is the specification.There exists an R such that, the same as before AND:

Page 51: Structuring instruction-sets with higher-order functions

51

What is bisimulation?

init n

init m

R

next n i

next m i

RR

“m” is the implementation, “n” is the specification.There exists an R such that, the same as before AND:

Page 52: Structuring instruction-sets with higher-order functions

52

What is bisimulation?

(m,n)BISIM iff R. ainit m, binit n. (a,b)R binit n, ainit m. (a,b)R (a,b)R, i, a’next m i a. b’next n i b and

(a’,b’)R (a,b)R, i, b’next n i b. a’next m i a and

(a’,b’)R (a,b)R. obs m a = obs n b

Page 53: Structuring instruction-sets with higher-order functions

53

What is flush-point correctness?

init n

init m

R R

obs n

obs m

Page 54: Structuring instruction-sets with higher-order functions

54

What is flush-point correctness?

R

Page 55: Structuring instruction-sets with higher-order functions

55

What is flush-point correctness?

R

Page 56: Structuring instruction-sets with higher-order functions

56

What is flush-point correctness?

R R

Page 57: Structuring instruction-sets with higher-order functions

57

Overview

Background Models and specifications Correctness Formal verification techniques

Extensions and higher-order functions

Conclusion

Page 58: Structuring instruction-sets with higher-order functions

58

How do we prove this?

n m SIM

Page 59: Structuring instruction-sets with higher-order functions

59

Abstraction

Page 60: Structuring instruction-sets with higher-order functions

60

Abstraction

Page 61: Structuring instruction-sets with higher-order functions

61

Abstraction

Page 62: Structuring instruction-sets with higher-order functions

62

Abstraction

Page 63: Structuring instruction-sets with higher-order functions

63

Abstraction

Page 64: Structuring instruction-sets with higher-order functions

64

History variables

Page 65: Structuring instruction-sets with higher-order functions

65

History variables

Page 66: Structuring instruction-sets with higher-order functions

66

History variables

Page 67: Structuring instruction-sets with higher-order functions

67

Prophecy variables

Page 68: Structuring instruction-sets with higher-order functions

68

Prophecy variables

Page 69: Structuring instruction-sets with higher-order functions

69

Prophecy variables

FP FP

Page 70: Structuring instruction-sets with higher-order functions

70

Prophecy variables

SIMFP

SIM FP

Page 71: Structuring instruction-sets with higher-order functions

71

Decomposition

Page 72: Structuring instruction-sets with higher-order functions

72

Decomposition

Page 73: Structuring instruction-sets with higher-order functions

73

Decomposition

Page 74: Structuring instruction-sets with higher-order functions

74

Decomposition

Page 75: Structuring instruction-sets with higher-order functions

75

Decomposition

Page 76: Structuring instruction-sets with higher-order functions

76

Overview

Background Models and specifications Correctness Formal verification techniques

Extensions and higher-order functions

Conclusion

Page 77: Structuring instruction-sets with higher-order functions

77

Overview

Background Extensions and higher-order

functions Conclusion

Page 78: Structuring instruction-sets with higher-order functions

78

Overview

Background Extensions and higher-order

functions Conclusion

Page 79: Structuring instruction-sets with higher-order functions

79

Overview

Background Extensions and higher-order functions

OA: an example extended ISA Modeling with transformers Proof decomposition with transformers Characterizing an important set of

transformers Conclusion

Page 80: Structuring instruction-sets with higher-order functions

80

The Oregon architecture.

r2 <- r2 – 1

r1 <- r1 * r3

pc <- 102

Page 81: Structuring instruction-sets with higher-order functions

81

The Oregon architecture.

r2 <- r2 – 1

r1 <- r1 * r3

pc <- 102

Page 82: Structuring instruction-sets with higher-order functions

82

The Oregon architecture.

r2 <- r2 – 1 if p2

r1 <- r1 * r3 if p2

pc <- 102 if p2

Page 83: Structuring instruction-sets with higher-order functions

83

The Oregon architecture.

r2 <- r2 – 1 if p2 in 1

r1 <- r1 * r3 if p2 in 0

pc <- 102 if p2 in 2

Page 84: Structuring instruction-sets with higher-order functions

84

The Oregon architecture.

101: r2 <- load 100 if p5 in 0

r1 <- 1 if p5 in 1 r3 <- r2 if p5 in 0

FENCE 102: r4 <- r2 != 0 if p5 in 0 p2,p3 <- r2p r4 if p5 in 0 r3 <- r2 if p5 in 1FENCE 103: r2 <- r2 – 1 if p2 in 1 r1 <- r1 * r3 if p2 in 0 pc <- 102 if p2 in 2

104: store 401 r1 if p3 in 3 pc <- 105 if p3 in 2 nopFENCE

Page 85: Structuring instruction-sets with higher-order functions

85

The Oregon architecture.

r2 <- load 100 if p5r3 <- r2 if p5

r1 <- 1 if p5 r4 <- r2 != 0 if p5p2,p3 <- r2p r4 if p5

r3 <- r2 if p5

pc <- 102 if p2pc <- 33 if p3

r1 <- r1 * r3 if p2

store 401 r1 if p3

r2 <- r2 - 1 if p2

Page 86: Structuring instruction-sets with higher-order functions

86

Overview

Background Extensions and higher-order functions

OA: an example extended ISA Modeling with transformers Proof decomposition with transformers Characterizing an important set of

transformers Conclusion

Page 87: Structuring instruction-sets with higher-order functions

87

Transformers

Transformers are functions between transition systems.

Composition of transformers rather than monolithic transition systems.

More modular specifications and models.

A new axis for decomposition. Proof re-use.

Page 88: Structuring instruction-sets with higher-order functions

88

Modeling systems as the composition of functions.

RISC

Page 89: Structuring instruction-sets with higher-order functions

89

Modeling systems as the composition of functions.

RISC

Back

end

Predicate Register

File

Fronte

nd

Page 90: Structuring instruction-sets with higher-order functions

90

Modeling systems as the composition of functions.

RISC

Back

end

Predicate

Register

FileFro

nte

nd

Page 91: Structuring instruction-sets with higher-order functions

91

Modeling systems as the composition of functions.

RISC

Back

end

Predicate

Register

FileFro

nte

nd

InstructionBuffer

InstructionBuffer

InstructionBuffer

Dispatch Control

Page 92: Structuring instruction-sets with higher-order functions

92

Modeling systems as the composition of functions.

RISC

Back

end

Predicate

Register

FileFro

nte

nd

InstructionBuffer

InstructionBuffer

InstructionBuffer

Dispatch

ProgramMemory (p)

Control

Page 93: Structuring instruction-sets with higher-order functions

93

The Oregon architecture.

oa p = fnt p (cnc 1 (prd risc))

Page 94: Structuring instruction-sets with higher-order functions

94

The Oregon architecture.

oa p = fnt p (cnc 1 (prd risc))

Familiar friend

Page 95: Structuring instruction-sets with higher-order functions

95

The Oregon architecture.

oa p = fnt p (cnc 1 (prd risc))

Takes any transition system and adds predication

Page 96: Structuring instruction-sets with higher-order functions

96

The Oregon architecture.

oa p = fnt p (cnc 1 (prd risc))

Adds explicit concurrency instructions

Page 97: Structuring instruction-sets with higher-order functions

97

The Oregon architecture.

oa p = fnt p (cnc 1 (prd risc))

Adds a front-end with program fetch

Page 98: Structuring instruction-sets with higher-order functions

98

Modeling systems as the composition of functions.

InstructionBuffer

InstructionBuffer

InstructionBuffer

Dispatch

ProgramMemory (p)

ControlPredicated

RISCPipeline

PredicatedRISC

Pipeline

PredicatedRISC

Pipeline

Page 99: Structuring instruction-sets with higher-order functions

99

Oregon microarchitectural implementaton.

ma p = fnt p (cnc 3 prd_pipe)

Page 100: Structuring instruction-sets with higher-order functions

100

Oregon microarchitectural implementaton.

ma p = fnt p (cnc 3 prd_pipe)

Higher-performance predicated pipeline

Page 101: Structuring instruction-sets with higher-order functions

101

Modeling systems as the composition of functions.

prd :: (……,Bubble i,Collection c,Eq r,……) => TS c i s (Obs (Env r w)) -> TS c (Prd_Instr i r) (Prd_St s r i) (Obs (Env r w))

Page 102: Structuring instruction-sets with higher-order functions

102

Modeling systems as the composition of functions.

prd :: (……,Bubble i,Collection c,Eq r,……) => TS c i s (Obs (Env r w)) -> TS c (Prd_Instr i r) (Prd_St s r i) (Obs (Env r w))

Polymorphic with respect to s

Page 103: Structuring instruction-sets with higher-order functions

103

Modeling systems as the composition of functions.

prd :: (……,Bubble i,Collection c,Eq r,……) => TS c i s (Obs (Env r w)) -> TS c (Prd_Instr i r) (Prd_St s r i) (Obs (Env r w))

c (whatever it is) has to be a collection-type

Page 104: Structuring instruction-sets with higher-order functions

104

Modeling systems as the composition of functions.

class Collection c where

unit :: a -> c a

join :: c (c a) -> c a

union :: c a -> c a -> c a

map :: (a -> b) -> c a -> c b

Page 105: Structuring instruction-sets with higher-order functions

105

Prd_Instr type.

data Prd_Instr i r = R2P r r r

| P2R r r

| SET r Bool

| IF i r

| GO i

Page 106: Structuring instruction-sets with higher-order functions

106

Prd_St type.

type Prd_St s r i = (s,Env r Bool,……)

Page 107: Structuring instruction-sets with higher-order functions

107

Modeling systems as the composition of functions.

prd :: (……,Bubble i,Collection c,Eq r,……) => TS c i s (Obs (Env r w)) -> TS c (Prd_Instr i r) (Prd_St s r i) (Obs (Env r w))

One of the advantages: predication is defined in isolation.

Page 108: Structuring instruction-sets with higher-order functions

108

Modeling systems as the composition of functions.

Other possibilities…..

oa p = fnt p (prd (cnc 1 risc))

oa p = prd (fnt p (cnc 1 risc))

oa p = prd (prd (prd risc))

Page 109: Structuring instruction-sets with higher-order functions

109

Overview

Background Extensions and higher-order functions

OA: an example extended ISA Modeling with transformers Proof decomposition with transformers Characterizing an important set of

transformers Conclusion

Page 110: Structuring instruction-sets with higher-order functions

110

Now what?

Now, let us look at how we can leverage the extra structure

Page 111: Structuring instruction-sets with higher-order functions

111

Decomposition.

(f m,g n) SIM

Page 112: Structuring instruction-sets with higher-order functions

112

Decomposition.

(f m,g n) SIM

Here’s the structure that we’re going to leverage.

Page 113: Structuring instruction-sets with higher-order functions

113

Decomposition.

(f m,g n) SIM

Page 114: Structuring instruction-sets with higher-order functions

114

Decomposition.

(m,n) A

(a,b)A. (f a, g b)SIM

Page 115: Structuring instruction-sets with higher-order functions

115

Decomposition.

(m,n) A

(a,b)A. (f a, g b)SIM

We’re abstracting over m and n.

Page 116: Structuring instruction-sets with higher-order functions

116

New notation:

(f, g) RQ

is defined as

(a,b)Q. (f a, g b)R

Page 117: Structuring instruction-sets with higher-order functions

117

New notation:

(g, g’) RQ

is defined as

(a,b)Q. (g a, g’ b)R

Note: monotonicity is (f,f) RR

Page 118: Structuring instruction-sets with higher-order functions

118

Decomposition.

(m,n) A

(a,b)A. (f a, g b)SIM

Page 119: Structuring instruction-sets with higher-order functions

119

Decomposition.

(m,n) A

(f, g) SIMA

Page 120: Structuring instruction-sets with higher-order functions

120

(ma,oa) FP(ma,oa) FP

Page 121: Structuring instruction-sets with higher-order functions

121

(ma,oa) FP(ma,oa) FP

Now, let’s decompose the proof using our available techniques

Page 122: Structuring instruction-sets with higher-order functions

122

(ma,oa) FP(ma,oa) FP

Page 123: Structuring instruction-sets with higher-order functions

123

(ma,oa) FP(fnt p (cnc 3 prd_pipe), fnt p (cnc 1 (prd risc))) FP

Page 124: Structuring instruction-sets with higher-order functions

124

(ma,oa) FP((fnt p o cnc 3) prd_pipe, (fnt p o cnc 1 o prd) risc) FP

function composition

Page 125: Structuring instruction-sets with higher-order functions

125

(ma,oa) FP

(fnt o cnc 3,fnt o cnc 1) FPFP

(prd_pipe,prd risc) FP

Rule: decomposition

((fnt p o cnc 3) prd_pipe, (fnt p o cnc 1 o prd) risc) FP

Page 126: Structuring instruction-sets with higher-order functions

126

(ma,oa) FP(ma,oa) FP

(fnt o cnc 3,fnt o cnc 1) FPFP

(prd_pipe,prd risc) FP

Page 127: Structuring instruction-sets with higher-order functions

127

(ma,oa) FP(ma,oa) FP

(fnt o cnc 3,fnt o cnc 1) FPFP

(prd_pipe,prd risc) FP

(fnt,fnt) FPFP

(cnc 3,cnc 1) FPFP

Rule: decomposition

Page 128: Structuring instruction-sets with higher-order functions

128

(ma,oa) FP(ma,oa) FP

(fnt o cnc 3,fnt o cnc 1) FPFP

(prd_pipe,prd risc) FP

(fnt,fnt) FPFP

(cnc 3,cnc 1) FPFP

Reasoning: fnt adds no state

Page 129: Structuring instruction-sets with higher-order functions

129

(ma,oa) FP(ma,oa) FP

(fnt o cnc 3,fnt o cnc 1) FPFP

(prd_pipe,prd risc) FP

(fnt,fnt) FPFP

(cnc 3,cnc 1) FPFP

Reasoning: Some hard reasoning here. Essentially: cnc expects no hazards amongst different threads.

☺☺

Page 130: Structuring instruction-sets with higher-order functions

130

(ma,oa) FP(ma,oa) FP

(fnt o cnc 3,fnt o cnc 1) FPFP

(prd_pipe,prd risc) FP

(fnt,fnt) FPFP

(cnc 3,cnc 1) FPFP

Rule: Transitivity of FP and intermediate model prd pipe

(prd_pipe,prd pipe) FP

(prd pipe,prd risc) FP☺☺

Page 131: Structuring instruction-sets with higher-order functions

131

(ma,oa) FP(ma,oa) FP

(fnt o cnc 3,fnt o cnc 1) FPFP

(prd_pipe,prd risc) FP

(fnt,fnt) FPFP

(cnc 3,cnc 1) FPFP

Rule: Transitivity of FP and intermediate model prd pipe

(prd_pipe,prd pipe) FP

(prd pipe,prd risc) FP☺☺

Page 132: Structuring instruction-sets with higher-order functions

132

(ma,oa) FP(ma,oa) FP

(fnt o cnc 3,fnt o cnc 1) FPFP

(prd_pipe,prd risc) FP

(fnt,fnt) FPFP

(cnc 3,cnc 1) FPFP

Rule: Decomposition and strengthening

(prd_pipe,prd pipe) FP

(prd pipe,prd risc) FP

(prd,prd) SIMSIM

(pipe,risc) SIM

☺☺

Page 133: Structuring instruction-sets with higher-order functions

133

(ma,oa) FP(ma,oa) FP

(fnt o cnc 3,fnt o cnc 1) FPFP

(prd_pipe,prd risc) FP

(fnt,fnt) FPFP

(cnc 3,cnc 1) FPFP

Reasoning: Many techniques available for this.

(prd_pipe,prd pipe) FP

(prd pipe,prd risc) FP

(prd,prd) SIMSIM

(pipe,risc) SIM

☺☺

Page 134: Structuring instruction-sets with higher-order functions

134

(ma,oa) FP(ma,oa) FP

(fnt o cnc 3,fnt o cnc 1) FPFP

(prd_pipe,prd risc) FP

(fnt,fnt) FPFP

(cnc 3,cnc 1) FPFP

Rule: Surprisingly hard. More later………

(prd_pipe,prd pipe) FP

(prd pipe,prd risc) FP

(prd,prd) SIMSIM

(pipe,risc) SIM

☺☺

☺☺

Page 135: Structuring instruction-sets with higher-order functions

135

(ma,oa) FP

(prd_pipe,prd pipe) FP

Page 136: Structuring instruction-sets with higher-order functions

136

(ma,oa) FP

Rule: using intermediate model slow prd_pipe. Also using SIMFP.

(prd_pipe,prd pipe) FP

(prd_pipe,slow prd_pipe) FP

(slow prd_pipe, prd pipe) SIM

Page 137: Structuring instruction-sets with higher-order functions

137

(ma,oa) FP

Reasoning: Techniques available for this. Essentially “self-consistency”.

(prd_pipe,prd pipe) FP

(prd_pipe,slow prd_pipe) FP

(slow prd_pipe, prd pipe) SIM☺

Page 138: Structuring instruction-sets with higher-order functions

138

(ma,oa) FP

Reasoning: Simulation relation given in dissertation.

(prd_pipe,prd pipe) FP

(prd_pipe,slow prd_pipe) FP

(slow prd_pipe, prd pipe) SIM☺ ☺

Page 139: Structuring instruction-sets with higher-order functions

139

(ma,oa) FP(ma,oa) FP

(fnt o cnc 3,fnt o cnc 1) FPFP

(prd_pipe,prd risc) FP

(fnt,fnt) FPFP

(cnc 3,cnc 1) FPFP

(prd_pipe,prd pipe) FP

(prd pipe,prd risc) FP

(prd_pipe,slow prd_pipe) FP

(slow prd_pipe, prd pipe) SIM

(prd,prd) SIMSIM

(pipe,risc) SIM

Page 140: Structuring instruction-sets with higher-order functions

140

Overview

Background Extensions and higher-order functions

OA: an example extended ISA Modeling with transformers Proof decomposition with transformers Characterizing an important set of

transformers Conclusion

Page 141: Structuring instruction-sets with higher-order functions

141

Monotonicity.

What about the case:

(prd m, prd n) SIM

Page 142: Structuring instruction-sets with higher-order functions

142

Monotonicity.

By the decomposition rule:

(m,n) SIM

(prd, prd) SIMSIM

Page 143: Structuring instruction-sets with higher-order functions

143

Monotonicity.

By the decomposition rule:

(m,n) SIM

(prd, prd) SIMSIMUnfortunately, we don’t get this automatically

Page 144: Structuring instruction-sets with higher-order functions

144

Monotonicity.

Dissertation characterizes a set of transformers such that: (f, f) SIMSIM

Same for BISIMBISIM.

Page 145: Structuring instruction-sets with higher-order functions

145

BISIMBISIM

Question: Why aren’t all transformers monotonic with respect to BISIM?

Answer: The troublesome transformers are those that are not polymorphic in their state.

Page 146: Structuring instruction-sets with higher-order functions

146

Models and specifications

0 4

Page 147: Structuring instruction-sets with higher-order functions

147

BISIMBISIM

f :: TS FSet Int i o -> TS FSet Int i o f (init,next,obs) = (init’,next,obs) where init’ = init – {4}

.

Page 148: Structuring instruction-sets with higher-order functions

148

Models and specifications

0

Page 149: Structuring instruction-sets with higher-order functions

149

BISIMBISIM

The solution: use a polymorphic transformer.

f :: TS FSet s I O -> TS FSet (F s) I’ O’

Dissertation proves that

(f, f) BISIMBISIM

Note: f’s definition does not matter.

Page 150: Structuring instruction-sets with higher-order functions

150

BISIMBISIM

The solution: use a polymorphic transformer

f :: TS FSet s I O -> TS FSet (F s) I’ O’

Dissertation proves that

(f, f) BISIMBISIM

Proof is based on the theory of Parametricity.

Page 151: Structuring instruction-sets with higher-order functions

151

BISIMBISIM

The solution: use a polymorphic transformer

f :: TS FSet s I O -> TS FSet (F s) I’ O’

Dissertation proves that

(f, f) BISIMBISIM

Proof is based on the theory of Parametricity……and I actually check it too.

Page 152: Structuring instruction-sets with higher-order functions

152

SIMSIM

Assume that

f :: TS FSet s I O -> TS FSet (F s) I’ O’

Unfortunately, there are cases where

(f, f) SIMSIM

Page 153: Structuring instruction-sets with higher-order functions

153

SIMSIM

Question: Why aren’t all polymorphic transformers monotonic with respect to SIM?

Answer: polymorphic transformers can still look at the structure of sets.

Page 154: Structuring instruction-sets with higher-order functions

154

Models and specifications

Page 155: Structuring instruction-sets with higher-order functions

155

SIMSIM

f :: TS FSet s i o -> TS FSet s i Bool f (init,next,obs) = (init,next,obs’) where obs’ x = if (|init|<2) then False else True

.

Page 156: Structuring instruction-sets with higher-order functions

156

Models and specifications

Page 157: Structuring instruction-sets with higher-order functions

157

SIMSIM

The solution: limit the set-like operations that f has access to by putting constraint in the type:

f :: Container c => TS c s I O -> TS c (F s) I’ O’

Dissertation proves that

(f, f) SIMSIM

Proof is, again, based on Parametricity.

Page 158: Structuring instruction-sets with higher-order functions

158

Collection

class Collection c where

unit :: a -> c a

join :: c (c a) -> c a

union :: c a -> c a -> c a

map :: (a -> b) -> c a -> c b

Page 159: Structuring instruction-sets with higher-order functions

159

SIMSIM

The solution: limit the set-like operations that f has access to

f :: Container c => TS c s I O -> TS c (F s) I’ O’

Dissertation proves that

(f, f) SIMSIM

This probably seems limiting: but both prd and fnt are examples.

Page 160: Structuring instruction-sets with higher-order functions

160

Overview

Background Extensions and higher-order functions

OA: an example extended ISA Modeling with transformers Proof decomposition with transformers Characterizing an important set of

transformers Conclusion

Page 161: Structuring instruction-sets with higher-order functions

161

Overview

Background Extensions and higher-order

functions Conclusion

Page 162: Structuring instruction-sets with higher-order functions

162

Overview

Background Extensions and higher-order

functions Conclusion

Page 163: Structuring instruction-sets with higher-order functions

163

Conclusion

Higher-order functions can be used to facilitate both the design of architectural extensions and the correctness proofs of their implementations.

Dissertation provides: A modeling method based on higher-order

functions for instruction-set extensions. Decomposition and discharge rules for models

written using the modeling method. Reusable extension specifications. Proof re-use.

Page 164: Structuring instruction-sets with higher-order functions

164

Summary

The dissertation: Reviews the history of processor verification. Develops the theory necessary to model

microproccessors and do FV. Develops a next generation VLIW-like instruction-set

with predication and concurrency instructions Develops a microarchitectural implementation. Develops the theory that allows us to leverage the

higher-order functions Demonstrates how a microarchitectural correctness

proof can be decomposed and structured.

Page 165: Structuring instruction-sets with higher-order functions

165

(ma,oa) FP(ma,oa) FP

(fnt o cnc 3,fnt o cnc 1) FPFP

(prd_pipe,prd risc) FP

(fnt,fnt) FPFP

(cnc 3,cnc 1) FPFP

(prd_pipe,pipe pipe) FP

(prd pipe,prd risc) FP

(prd_pipe,slow prd_pipe) FP

(slow prd_pipe, prd pipe) SIM

(prd,prd) SIMSIM

(pipe,risc) SIM