Verifying Bit-Manipulations of Floating-P oint Wonyeol Lee Rahul - - PowerPoint PPT Presentation

โ–ถ
verifying bit manipulations
SMART_READER_LITE
LIVE PREVIEW

Verifying Bit-Manipulations of Floating-P oint Wonyeol Lee Rahul - - PowerPoint PPT Presentation

Verifying Bit-Manipulations of Floating-P oint Wonyeol Lee Rahul Sharma Alex Aiken Stanford University PLDI 2016 This Talk Example: mathematical specification Goal: Bound the difference between spec and implementation


slide-1
SLIDE 1

Verifying Bit-Manipulations

  • f Floating-P
  • int

Wonyeol Lee

Rahul Sharma Alex Aiken Stanford University PLDI 2016

slide-2
SLIDE 2

This Talk

  • Example:
  • Goal:

Bound the difference between spec and implementation

  • Key contribution:

Verify binaries that mix floating-point and bit- level operations

  • ๐‘“๐‘ฆ

mathematical specification

2

slide-3
SLIDE 3

This Talk

  • Example:
  • Goal:

Bound the difference between spec and implementation

  • Key contribution:

Verify binaries that mix floating-point and bit- level operations

  • ๐‘“๐‘ฆ

floating-point implementation ... vpslld $20, %xmm3, %xmm3 vpshufd $114, %xmm3, %xmm3 vmulpd C1, %xmm2, %xmm1 vmulpd C2, %xmm2, %xmm2 ... mathematical specification

3

slide-4
SLIDE 4

This Talk

  • Example:
  • Goal:

Bound the difference between spec and implementation

  • Key contribution:

Verify binaries that mix floating-point and bit- level operations

  • โ‰ 

๐‘“๐‘ฆ

floating-point implementation ... vpslld $20, %xmm3, %xmm3 vpshufd $114, %xmm3, %xmm3 vmulpd C1, %xmm2, %xmm1 vmulpd C2, %xmm2, %xmm2 ... mathematical specification

4

slide-5
SLIDE 5

This Talk

  • Example:
  • Goal:

Bound the difference between spec and implementation

  • Key contribution:

Verify binaries that mix floating-point and bit- level operations

  • โ‰ 

how different?

๐‘“๐‘ฆ

floating-point implementation ... vpslld $20, %xmm3, %xmm3 vpshufd $114, %xmm3, %xmm3 vmulpd C1, %xmm2, %xmm1 vmulpd C2, %xmm2, %xmm2 ... mathematical specification

5

slide-6
SLIDE 6

This Talk

  • Example:
  • Goal:

Bound the difference between spec and implementation

  • Key contribution:

Verify binaries that mix floating-point and bit- level operations

  • โ‰ 

how different?

๐‘“๐‘ฆ

floating-point implementation ... vpslld $20, %xmm3, %xmm3 vpshufd $114, %xmm3, %xmm3 vmulpd C1, %xmm2, %xmm1 vmulpd C2, %xmm2, %xmm2 ... mathematical specification

6

slide-7
SLIDE 7

This Talk

  • Example:
  • Goal:

Bound the difference between spec and implementation

  • Key contribution:

Verify binaries that mix floating-point and bit- level operations

  • โ‰ 

how different?

๐‘“๐‘ฆ

floating-point implementation ... vpslld $20, %xmm3, %xmm3 vpshufd $114, %xmm3, %xmm3 vmulpd C1, %xmm2, %xmm1 vmulpd C2, %xmm2, %xmm2 ... mathematical specification

7

slide-8
SLIDE 8

This Talk

  • Example:
  • Goal:

Bound the difference between spec and implementation

  • Key contribution:

Verify binaries that mix floating-point and bit- level operations

  • โ‰ 

how different?

๐‘“๐‘ฆ

floating-point implementation ... vpslld $20, %xmm3, %xmm3 vpshufd $114, %xmm3, %xmm3 vmulpd C1, %xmm2, %xmm1 vmulpd C2, %xmm2, %xmm2 ... mathematical specification

8

slide-9
SLIDE 9
  • Example:
  • Automatic reasoning about floating-point is not easy
  • have rounding errors
  • d
  • Associativity:

1 + 1030 โˆ’ 1030 = 1 โ‰  0 = (1 + 1030) โˆ’ 1030

  • It becomes much harder if bit-level operations are used

Floating-P

  • int Numbers

9

1 01111111111 1100โ‹ฏ00 (2) = โˆ’1 1 โˆ™ 21023โˆ’1023 โˆ™ 1.110 โ‹ฏ 00(2)

slide-10
SLIDE 10
  • Example:
  • Automatic reasoning about floating-point is not easy
  • have rounding errors
  • d
  • Associativity:

1 + 1030 โˆ’ 1030 = 1 โ‰  0 = (1 + 1030) โˆ’ 1030

  • It becomes much harder if bit-level operations are used

Floating-P

  • int Numbers

10

1 01111111111 1100โ‹ฏ00 (2) = โˆ’1 1 โˆ™ 21023โˆ’1023 โˆ™ 1.110 โ‹ฏ 00(2)

slide-11
SLIDE 11
  • Example:
  • Automatic reasoning about floating-point is not easy
  • have rounding errors
  • d
  • Associativity:

1 + 1030 โˆ’ 1030 = 1 โ‰  0 = (1 + 1030) โˆ’ 1030

  • It becomes much harder if bit-level operations are used

Floating-P

  • int Numbers

11

1 01111111111 1100โ‹ฏ00 (2) = โˆ’1 1 โˆ™ 21023โˆ’1023 โˆ™ 1.110 โ‹ฏ 00(2)

slide-12
SLIDE 12

Bit-Level Operations

  • Example:

Given ๐‘‚ (in int), compute 2๐‘‚ (in double)

  • Such bit-manipulations are ubiquitous in highly optimized

floating-point implementations

  • If a code mixes floating-point and bit-level operations,

reasoning about the code is difficult

12

slide-13
SLIDE 13

Bit-Level Operations

  • Example:

Given ๐‘‚ (in int), compute 2๐‘‚ (in double)

  • Such bit-manipulations are ubiquitous in highly optimized

floating-point implementations

  • If a code mixes floating-point and bit-level operations,

reasoning about the code is difficult

1 [int] 2๐‘‚ [int] 2๐‘‚ [double]

bit-shifting by ๐‘‚ converting from int to double here ๐‘‚ = 10

13

slide-14
SLIDE 14

Bit-Level Operations

  • Example:

Given ๐‘‚ (in int), compute 2๐‘‚ (in double)

  • Such bit-manipulations are ubiquitous in highly optimized

floating-point implementations

  • If a code mixes floating-point and bit-level operations,

reasoning about the code is difficult

1 [int] 2๐‘‚ [int] 2๐‘‚ [double]

bit-shifting by ๐‘‚ converting from int to double here ๐‘‚ = 10

14

expensive

slide-15
SLIDE 15

Bit-Level Operations

  • Example:

Given ๐‘‚ (in int), compute 2๐‘‚ (in double)

  • Such bit-manipulations are ubiquitous in highly optimized

floating-point implementations

  • If a code mixes floating-point and bit-level operations,

reasoning about the code is difficult

works only for 0 โ‰ค ๐‘‚ โ‰ค 31

1 [int] 2๐‘‚ [int] 2๐‘‚ [double]

bit-shifting by ๐‘‚ converting from int to double here ๐‘‚ = 10

15

expensive

slide-16
SLIDE 16

Bit-Level Operations

  • Example:

Given ๐‘‚ (in int), compute 2๐‘‚ (in double)

  • Such bit-manipulations are ubiquitous in highly optimized

floating-point implementations

  • If a code mixes floating-point and bit-level operations,

reasoning about the code is difficult

integer addition bit-shifting by 52

๐‘‚ [int] ๐‘‚ + 1023 [int] 00 โ‹ฏ 0 [52 bits]

[12 bits]

works only for 0 โ‰ค ๐‘‚ โ‰ค 31

1 [int] 2๐‘‚ [int] 2๐‘‚ [double]

bit-shifting by ๐‘‚ converting from int to double here ๐‘‚ = 10

16

expensive

slide-17
SLIDE 17

Bit-Level Operations

  • Example:

Given ๐‘‚ (in int), compute 2๐‘‚ (in double)

  • Such bit-manipulations are ubiquitous in highly optimized

floating-point implementations

  • If a code mixes floating-point and bit-level operations,

reasoning about the code is difficult

integer addition bit-shifting by 52

๐‘‚ [int] ๐‘‚ + 1023 [int] 00 โ‹ฏ 0 [52 bits]

[12 bits]

2๐‘‚ [double]

works only for 0 โ‰ค ๐‘‚ โ‰ค 31

1 [int] 2๐‘‚ [int] 2๐‘‚ [double]

bit-shifting by ๐‘‚ converting from int to double here ๐‘‚ = 10

17

expensive

slide-18
SLIDE 18

Bit-Level Operations

  • Example:

Given ๐‘‚ (in int), compute 2๐‘‚ (in double)

  • Such bit-manipulations are ubiquitous in highly optimized

floating-point implementations

  • If a code mixes floating-point and bit-level operations,

reasoning about the code is difficult

integer addition bit-shifting by 52

๐‘‚ [int] ๐‘‚ + 1023 [int] 00 โ‹ฏ 0 [52 bits]

[12 bits]

2๐‘‚ [double]

works only for 0 โ‰ค ๐‘‚ โ‰ค 31 works for โˆ’1022 โ‰ค ๐‘‚ โ‰ค 1023

1 [int] 2๐‘‚ [int] 2๐‘‚ [double]

bit-shifting by ๐‘‚ converting from int to double here ๐‘‚ = 10

18

expensive

slide-19
SLIDE 19

Bit-Level Operations

  • Example:

Given ๐‘‚ (in int), compute 2๐‘‚ (in double)

  • Such bit-manipulations are ubiquitous in highly optimized

floating-point implementations

  • If a code mixes floating-point and bit-level operations,

reasoning about the code is difficult

integer addition bit-shifting by 52

๐‘‚ [int] ๐‘‚ + 1023 [int] 00 โ‹ฏ 0 [52 bits]

[12 bits]

2๐‘‚ [double]

works only for 0 โ‰ค ๐‘‚ โ‰ค 31 works for โˆ’1022 โ‰ค ๐‘‚ โ‰ค 1023

1 [int] 2๐‘‚ [int] 2๐‘‚ [double]

bit-shifting by ๐‘‚ converting from int to double here ๐‘‚ = 10

19

expensive

slide-20
SLIDE 20

Problem Statement

  • Goal:

Find a small ฮ˜ > 0 such that

๐‘” ๐‘ฆ โˆ’๐‘„ ๐‘ฆ ๐‘”(๐‘ฆ)

โ‰ค ฮ˜ for all ๐‘ฆ โˆˆ ๐‘Œ

  • i.e.,

prove a bound on the maximum precision loss

mathematical specification

๐‘”: โ„ โ†’ โ„

๐‘“๐‘ฆ

20

slide-21
SLIDE 21

Problem Statement

  • Goal:

Find a small ฮ˜ > 0 such that

๐‘” ๐‘ฆ โˆ’๐‘„ ๐‘ฆ ๐‘”(๐‘ฆ)

โ‰ค ฮ˜ for all ๐‘ฆ โˆˆ ๐‘Œ

  • i.e.,

prove a bound on the maximum precision loss

binary ๐‘„ that mixes floating-point and bit-level operations mathematical specification

๐‘”: โ„ โ†’ โ„

๐‘“๐‘ฆ

... vpslld $20, %xmm3, %xmm3 vpshufd $114, %xmm3, %xmm3 vmulpd C1, %xmm2, %xmm1 vmulpd C2, %xmm2, %xmm2 ... vpslld vpshufd

21

slide-22
SLIDE 22

Problem Statement

  • Goal:

Find a small ฮ˜ > 0 such that

๐‘” ๐‘ฆ โˆ’๐‘„ ๐‘ฆ ๐‘”(๐‘ฆ)

โ‰ค ฮ˜ for all ๐‘ฆ โˆˆ ๐‘Œ

  • i.e.,

prove a bound on the maximum precision loss

binary ๐‘„ that mixes floating-point and bit-level operations mathematical specification

๐‘”: โ„ โ†’ โ„

๐‘“๐‘ฆ

input range ๐‘Œ โІ โ„

[โˆ’1, 1]

... vpslld $20, %xmm3, %xmm3 vpshufd $114, %xmm3, %xmm3 vmulpd C1, %xmm2, %xmm1 vmulpd C2, %xmm2, %xmm2 ... vpslld vpshufd

22

slide-23
SLIDE 23

Problem Statement

  • Goal:

Find a small ฮ˜ > 0 such that

๐‘” ๐‘ฆ โˆ’๐‘„ ๐‘ฆ ๐‘”(๐‘ฆ)

โ‰ค ฮ˜ for all ๐‘ฆ โˆˆ ๐‘Œ

  • i.e.,

prove a bound on the maximum precision loss

binary ๐‘„ that mixes floating-point and bit-level operations mathematical specification

๐‘”: โ„ โ†’ โ„

๐‘“๐‘ฆ

input range ๐‘Œ โІ โ„

[โˆ’1, 1]

... vpslld $20, %xmm3, %xmm3 vpshufd $114, %xmm3, %xmm3 vmulpd C1, %xmm2, %xmm1 vmulpd C2, %xmm2, %xmm2 ... vpslld vpshufd

23

slide-24
SLIDE 24

P

  • ssible Alternatives
  • Exhaustive testing
  • feasible for 32-bit float:

~ 30 seconds (with 1 core for sinf)

  • infeasible for 64-bit double:

> 4000 years (= 30 seconds ร— 232)

  • infeasible even for input range X = โˆ’1, 1

โˆต (# of doubles between โˆ’1 and 1) =

1 2 (# of all doubles)

  • Machine-checkable proofs
  • Harrison used

transcendental functions are very accurate [

]

  • construction of these proofs often requires considerable

persistence

24

slide-25
SLIDE 25

P

  • ssible Alternatives
  • Exhaustive testing
  • feasible for 32-bit float:

~ 30 seconds (with 1 core for sinf)

  • infeasible for 64-bit double:

> 4000 years (= 30 seconds ร— 232)

  • infeasible even for input range X = โˆ’1, 1

โˆต (# of doubles between โˆ’1 and 1) =

1 2 (# of all doubles)

  • Machine-checkable proofs
  • Harrison used

transcendental functions are very accurate [

]

  • construction of these proofs often requires considerable

persistence

25

slide-26
SLIDE 26

P

  • ssible Alternatives
  • Exhaustive testing
  • feasible for 32-bit float:

~ 30 seconds (with 1 core for sinf)

  • infeasible for 64-bit double:

> 4000 years (= 30 seconds ร— 232)

  • infeasible even for input range X = โˆ’1, 1

โˆต (# of doubles between โˆ’1 and 1) =

1 2 (# of all doubles)

  • Machine-checkable proofs
  • Harrison used

transcendental functions are very accurate [

]

  • construction of these proofs often requires considerable

persistence

26

slide-27
SLIDE 27

P

  • ssible Alternatives
  • Exhaustive testing
  • feasible for 32-bit float:

~ 30 seconds (with 1 core for sinf)

  • infeasible for 64-bit double:

> 4000 years (= 30 seconds ร— 232)

  • infeasible even for input range X = โˆ’1, 1

โˆต (# of doubles between โˆ’1 and 1) =

1 2 (# of all doubles)

  • Machine-checkable proofs
  • Harrison used

transcendental functions are very accurate [

]

  • construction of these proofs often requires considerable

persistence.

27

slide-28
SLIDE 28

P

  • ssible Automatic Alternatives
  • If only floating-point operations are used,

various automatic techniques can be applied

  • e.g.,

Astree , Fluctuat , ROSA , FPTaylor

  • Several commercial tools (e.g.,

Astree, Fluctuat) can handle certain bit-trick routines

  • We are unaware of a general technique for verifying

mixed floating-point and bit-level code

28

slide-29
SLIDE 29

P

  • ssible Automatic Alternatives
  • If only floating-point operations are used,

various automatic techniques can be applied

  • e.g.,

Astree , Fluctuat , ROSA , FPTaylor

  • Several commercial tools (e.g.,

Astree, Fluctuat) can handle certain bit-trick routines

  • We are unaware of a general technique for verifying

mixed floating-point and bit-level code

29

slide-30
SLIDE 30

Our Method

30

slide-31
SLIDE 31

1 vmovddup %xmm0, %xmm0 2 vmulpd L2E, %xmm0, %xmm2 3 vroundpd $0, %xmm2, %xmm2 4 vcvtpd2dqx %xmm2, %xmm3 5 vpaddd B, %xmm3, %xmm3 6 vpslld $20, %xmm3, %xmm3 7 vpshufd $114, %xmm3, %xmm3 8 vmulpd C1, %xmm2, %xmm1 9 vmulpd C2, %xmm2, %xmm2 10 vaddpd %xmm1, %xmm0, %xmm1 11 vaddpd %xmm2, %xmm1, %xmm1 12 vmovapd T1, %xmm0 13 vmulpd T12, %xmm1, %xmm2 14 vaddpd T11, %xmm2, %xmm2 ... 36 vaddpd %xmm0, %xmm1, %xmm0 37 vmulpd %xmm3, %xmm0, %xmm0 38 retq

๐‘“๐‘ฆ Explained

31

slide-32
SLIDE 32

1 vmovddup %xmm0, %xmm0 2 vmulpd L2E, %xmm0, %xmm2 3 vroundpd $0, %xmm2, %xmm2 4 vcvtpd2dqx %xmm2, %xmm3 5 vpaddd B, %xmm3, %xmm3 6 vpslld $20, %xmm3, %xmm3 7 vpshufd $114, %xmm3, %xmm3 8 vmulpd C1, %xmm2, %xmm1 9 vmulpd C2, %xmm2, %xmm2 10 vaddpd %xmm1, %xmm0, %xmm1 11 vaddpd %xmm2, %xmm1, %xmm1 12 vmovapd T1, %xmm0 13 vmulpd T12, %xmm1, %xmm2 14 vaddpd T11, %xmm2, %xmm2 ... 36 vaddpd %xmm0, %xmm1, %xmm0 37 vmulpd %xmm3, %xmm0, %xmm0 38 retq

๐‘“๐‘ฆ Explained

๐‘‚ = round ๐‘ฆ โˆ™ log2 ๐‘“ ๐‘ฆ

32

slide-33
SLIDE 33

1 vmovddup %xmm0, %xmm0 2 vmulpd L2E, %xmm0, %xmm2 3 vroundpd $0, %xmm2, %xmm2 4 vcvtpd2dqx %xmm2, %xmm3 5 vpaddd B, %xmm3, %xmm3 6 vpslld $20, %xmm3, %xmm3 7 vpshufd $114, %xmm3, %xmm3 8 vmulpd C1, %xmm2, %xmm1 9 vmulpd C2, %xmm2, %xmm2 10 vaddpd %xmm1, %xmm0, %xmm1 11 vaddpd %xmm2, %xmm1, %xmm1 12 vmovapd T1, %xmm0 13 vmulpd T12, %xmm1, %xmm2 14 vaddpd T11, %xmm2, %xmm2 ... 36 vaddpd %xmm0, %xmm1, %xmm0 37 vmulpd %xmm3, %xmm0, %xmm0 38 retq

2๐‘‚

๐‘“๐‘ฆ Explained

๐‘‚ = round ๐‘ฆ โˆ™ log2 ๐‘“ ๐‘ฆ

33

slide-34
SLIDE 34

1 vmovddup %xmm0, %xmm0 2 vmulpd L2E, %xmm0, %xmm2 3 vroundpd $0, %xmm2, %xmm2 4 vcvtpd2dqx %xmm2, %xmm3 5 vpaddd B, %xmm3, %xmm3 6 vpslld $20, %xmm3, %xmm3 7 vpshufd $114, %xmm3, %xmm3 8 vmulpd C1, %xmm2, %xmm1 9 vmulpd C2, %xmm2, %xmm2 10 vaddpd %xmm1, %xmm0, %xmm1 11 vaddpd %xmm2, %xmm1, %xmm1 12 vmovapd T1, %xmm0 13 vmulpd T12, %xmm1, %xmm2 14 vaddpd T11, %xmm2, %xmm2 ... 36 vaddpd %xmm0, %xmm1, %xmm0 37 vmulpd %xmm3, %xmm0, %xmm0 38 retq

๐‘“๐‘ฆ = ๐‘“๐‘‚โˆ™ln 2 โˆ™ ๐‘“๐‘  โ‰ˆ 2๐‘‚ โˆ™ ๐‘“๐‘  ๐‘“๐‘  โ‰ˆ เท

๐‘—=0 12 ๐‘ ๐‘—

๐‘—! ๐‘  = ๐‘ฆ โˆ’ ๐‘‚ โˆ™ ln 2 2๐‘‚

๐‘“๐‘ฆ Explained

๐‘‚ = round ๐‘ฆ โˆ™ log2 ๐‘“ ๐‘ฆ

34

slide-35
SLIDE 35

1 vmovddup %xmm0, %xmm0 2 vmulpd L2E, %xmm0, %xmm2 3 vroundpd $0, %xmm2, %xmm2 4 vcvtpd2dqx %xmm2, %xmm3 5 vpaddd B, %xmm3, %xmm3 6 vpslld $20, %xmm3, %xmm3 7 vpshufd $114, %xmm3, %xmm3 8 vmulpd C1, %xmm2, %xmm1 9 vmulpd C2, %xmm2, %xmm2 10 vaddpd %xmm1, %xmm0, %xmm1 11 vaddpd %xmm2, %xmm1, %xmm1 12 vmovapd T1, %xmm0 13 vmulpd T12, %xmm1, %xmm2 14 vaddpd T11, %xmm2, %xmm2 ... 36 vaddpd %xmm0, %xmm1, %xmm0 37 vmulpd %xmm3, %xmm0, %xmm0 38 retq

๐‘“๐‘ฆ = ๐‘“๐‘‚โˆ™ln 2 โˆ™ ๐‘“๐‘  โ‰ˆ 2๐‘‚ โˆ™ ๐‘“๐‘  ๐‘“๐‘  โ‰ˆ เท

๐‘—=0 12 ๐‘ ๐‘—

๐‘—! ๐‘  = ๐‘ฆ โˆ’ ๐‘‚ โˆ™ ln 2 2๐‘‚

๐‘“๐‘ฆ Explained

๐‘‚ = round ๐‘ฆ โˆ™ log2 ๐‘“ ๐‘ฆ

Goal: Find a small ฮ˜ > 0 such that

๐‘“๐‘ฆโˆ’2๐‘‚๐‘“๐‘  ๐‘“๐‘ฆ

โ‰ค ฮ˜ for all ๐‘ฆ โˆˆ ๐‘Œ

35

slide-36
SLIDE 36
  • Assume only floating-point operations are used
  • 1 + ๐œ—

property

  • A standard way to model rounding errors
  • For 64-bit doubles,

๐œ— = 2โˆ’53

  • This property has been used in previous automatic techniques

(FPTaylor

  • point programs

1) Abstract Floating-P

  • int Operations

36

slide-37
SLIDE 37
  • Assume only floating-point operations are used
  • 1 + ๐œ—

property

  • A standard way to model rounding errors
  • For 64-bit doubles,

๐œ— = 2โˆ’53

  • This property has been used in previous automatic techniques

(FPTaylor

  • point programs

1) Abstract Floating-P

  • int Operations

37

slide-38
SLIDE 38
  • Assume only floating-point operations are used
  • 1 + ๐œ—

property

  • A standard way to model rounding errors
  • For 64-bit doubles,

๐œ— = 2โˆ’53

  • This property has been used in previous automatic techniques

(FPTaylor

  • point programs

๐‘ฆ โจ‚f ๐‘ง โˆˆ ๐‘ฆโจ‚๐‘ง 1 + ๐œ€ โˆถ ๐œ€ < ๐œ—

1) Abstract Floating-P

  • int Operations

38

slide-39
SLIDE 39
  • Assume only floating-point operations are used
  • 1 + ๐œ—

property

  • A standard way to model rounding errors
  • For 64-bit doubles,

๐œ— = 2โˆ’53

  • This property has been used in previous automatic techniques

(FPTaylor

  • point programs

๐‘ฆ โจ‚f ๐‘ง โˆˆ ๐‘ฆโจ‚๐‘ง 1 + ๐œ€ โˆถ ๐œ€ < ๐œ—

1) Abstract Floating-P

  • int Operations

39

๐‘ฆโจ‚๐‘ง

1

slide-40
SLIDE 40
  • Assume only floating-point operations are used
  • 1 + ๐œ—

property

  • A standard way to model rounding errors
  • For 64-bit doubles,

๐œ— = 2โˆ’53

  • This property has been used in previous automatic techniques

(FPTaylor

  • point programs

๐‘ฆ โจ‚f ๐‘ง โˆˆ ๐‘ฆโจ‚๐‘ง 1 + ๐œ€ โˆถ ๐œ€ < ๐œ—

1) Abstract Floating-P

  • int Operations

40

๐‘ฆโจ‚๐‘ง

1

slide-41
SLIDE 41
  • Assume only floating-point operations are used
  • 1 + ๐œ—

property

  • A standard way to model rounding errors
  • For 64-bit doubles,

๐œ— = 2โˆ’53

  • This property has been used in previous automatic techniques

(FPTaylor

  • point programs

๐‘ฆ โจ‚f ๐‘ง โˆˆ ๐‘ฆโจ‚๐‘ง 1 + ๐œ€ โˆถ ๐œ€ < ๐œ—

1) Abstract Floating-P

  • int Operations

41

๐‘ฆ โจ‚f ๐‘ง ๐‘ฆโจ‚๐‘ง

1

slide-42
SLIDE 42
  • Assume only floating-point operations are used
  • 1 + ๐œ—

property

  • A standard way to model rounding errors
  • For 64-bit doubles,

๐œ— = 2โˆ’53

  • This property has been used in previous automatic techniques

(FPTaylor

  • point programs

๐‘ฆ โจ‚f ๐‘ง โˆˆ ๐‘ฆโจ‚๐‘ง 1 + ๐œ€ โˆถ ๐œ€ < ๐œ—

1) Abstract Floating-P

  • int Operations

42

๐‘ฆ โจ‚f ๐‘ง ๐‘ฆโจ‚๐‘ง

1

๐œ—

slide-43
SLIDE 43
  • Assume only floating-point operations are used
  • 1 + ๐œ—

property

  • A standard way to model rounding errors
  • For 64-bit doubles,

๐œ— = 2โˆ’53

  • This property has been used in previous automatic techniques

(FPTaylor

  • point programs

๐‘ฆ โจ‚f ๐‘ง โˆˆ ๐‘ฆโจ‚๐‘ง 1 + ๐œ€ โˆถ ๐œ€ < ๐œ—

1) Abstract Floating-P

  • int Operations

43

๐‘ฆ โจ‚f ๐‘ง ๐‘ฆโจ‚๐‘ง

1

๐œ—

slide-44
SLIDE 44
  • Compute a symbolic abstraction ๐ต๐œ€ ๐‘ฆ
  • f a program ๐‘„
  • Example:
  • F

rom 1 + ๐œ— property, ๐ต๐œ€ ๐‘ฆ satisfies

๐‘„ ๐‘ฆ โˆˆ ๐ต๐œ€ ๐‘ฆ โˆถ ๐œ€๐‘— < ๐œ— for all ๐‘ฆ

  • Example:

1) Abstract Floating-P

  • int Operations

44

slide-45
SLIDE 45
  • Compute a symbolic abstraction ๐ต๐œ€ ๐‘ฆ
  • f a program ๐‘„
  • Example:
  • F

rom 1 + ๐œ— property, ๐ต๐œ€ ๐‘ฆ satisfies

๐‘„ ๐‘ฆ โˆˆ ๐ต๐œ€ ๐‘ฆ โˆถ ๐œ€๐‘— < ๐œ— for all ๐‘ฆ

  • Example:

1) Abstract Floating-P

  • int Operations

45

๐‘„ ๐‘ฆ = 2 ร—f ๐‘ฆ 1 + ๐œ€1 +f 3 1 + ๐œ€2

slide-46
SLIDE 46
  • Compute a symbolic abstraction ๐ต๐œ€ ๐‘ฆ
  • f a program ๐‘„
  • Example:
  • F

rom 1 + ๐œ— property, ๐ต๐œ€ ๐‘ฆ satisfies

๐‘„ ๐‘ฆ โˆˆ ๐ต๐œ€ ๐‘ฆ โˆถ ๐œ€๐‘— < ๐œ— for all ๐‘ฆ

  • Example:

1) Abstract Floating-P

  • int Operations

46

๐‘„ ๐‘ฆ = 2 ร—f ๐‘ฆ 1 + ๐œ€1 +f 3 1 + ๐œ€2 ๐ต๐œ€ ๐‘ฆ

slide-47
SLIDE 47
  • Compute a symbolic abstraction ๐ต๐œ€ ๐‘ฆ
  • f a program ๐‘„
  • Example:
  • F

rom 1 + ๐œ— property, ๐ต๐œ€ ๐‘ฆ satisfies

๐‘„ ๐‘ฆ โˆˆ ๐ต๐œ€ ๐‘ฆ โˆถ ๐œ€๐‘— < ๐œ— for all ๐‘ฆ

  • Example:

1) Abstract Floating-P

  • int Operations

47

๐‘„ ๐‘ฆ = 2 ร—f ๐‘ฆ 1 + ๐œ€1 +f 3 1 + ๐œ€2 ๐ต๐œ€ ๐‘ฆ ร— +

slide-48
SLIDE 48
  • Compute a symbolic abstraction ๐ต๐œ€ ๐‘ฆ
  • f a program ๐‘„
  • Example:
  • F

rom 1 + ๐œ— property, ๐ต๐œ€ ๐‘ฆ satisfies

๐‘„ ๐‘ฆ โˆˆ ๐ต๐œ€ ๐‘ฆ โˆถ ๐œ€๐‘— < ๐œ— for all ๐‘ฆ

  • Example:

1) Abstract Floating-P

  • int Operations

48

๐‘„ ๐‘ฆ = 2 ร—f ๐‘ฆ 1 + ๐œ€1 +f 3 1 + ๐œ€2 ๐ต๐œ€ ๐‘ฆ ร— +

slide-49
SLIDE 49
  • Compute a symbolic abstraction ๐ต๐œ€ ๐‘ฆ
  • f a program ๐‘„
  • Example:
  • F

rom 1 + ๐œ— property, ๐ต๐œ€ ๐‘ฆ satisfies

๐‘„ ๐‘ฆ โˆˆ ๐ต๐œ€ ๐‘ฆ โˆถ ๐œ€๐‘— < ๐œ— for all ๐‘ฆ

  • Example:

1) Abstract Floating-P

  • int Operations

49

๐‘„ ๐‘ฆ = 2 ร—f ๐‘ฆ 1 + ๐œ€1 +f 3 1 + ๐œ€2 ๐ต๐œ€ ๐‘ฆ ร— +

slide-50
SLIDE 50
  • Compute a symbolic abstraction ๐ต๐œ€ ๐‘ฆ
  • f a program ๐‘„
  • Example:
  • F

rom 1 + ๐œ— property, ๐ต๐œ€ ๐‘ฆ satisfies

๐‘„ ๐‘ฆ โˆˆ ๐ต๐œ€ ๐‘ฆ โˆถ ๐œ€๐‘— < ๐œ— for all ๐‘ฆ

  • Example:

๐‘„ ๐‘ฆ = 2 ร—f ๐‘ฆ 1 + ๐œ€1 +f 3 1 + ๐œ€2 โˆถ ๐œ€1 , ๐œ€2 < ๐œ—

1) Abstract Floating-P

  • int Operations

50

๐‘„ ๐‘ฆ = 2 ร—f ๐‘ฆ 1 + ๐œ€1 +f 3 1 + ๐œ€2 ๐ต๐œ€ ๐‘ฆ ร— +

slide-51
SLIDE 51
  • Compute a symbolic abstraction ๐ต๐œ€ ๐‘ฆ
  • f a program ๐‘„
  • Example:
  • F

rom 1 + ๐œ— property, ๐ต๐œ€ ๐‘ฆ satisfies

๐‘„ ๐‘ฆ โˆˆ ๐ต๐œ€ ๐‘ฆ โˆถ ๐œ€๐‘— < ๐œ— for all ๐‘ฆ

  • Example:

๐‘„ ๐‘ฆ = 2 ร—f ๐‘ฆ 1 + ๐œ€1 +f 3 1 + ๐œ€2 โˆถ ๐œ€1 , ๐œ€2 < ๐œ—

1) Abstract Floating-P

  • int Operations

51

๐‘„ ๐‘ฆ = 2 ร—f ๐‘ฆ 1 + ๐œ€1 +f 3 1 + ๐œ€2 ๐ต๐œ€ ๐‘ฆ ร— + + ร—

} {

slide-52
SLIDE 52
  • Compute a symbolic abstraction ๐ต๐œ€ ๐‘ฆ
  • f a program ๐‘„
  • Example:
  • F

rom 1 + ๐œ— property, ๐ต๐œ€ ๐‘ฆ satisfies

๐‘„ ๐‘ฆ โˆˆ ๐ต๐œ€ ๐‘ฆ โˆถ ๐œ€๐‘— < ๐œ— for all ๐‘ฆ

  • Example:

๐‘„ ๐‘ฆ = 2 ร—f ๐‘ฆ 1 + ๐œ€1 +f 3 1 + ๐œ€2 โˆถ ๐œ€1 , ๐œ€2 < ๐œ—

1) Abstract Floating-P

  • int Operations

52

๐‘„ ๐‘ฆ = 2 ร—f ๐‘ฆ 1 + ๐œ€1 +f 3 1 + ๐œ€2 ๐ต๐œ€ ๐‘ฆ ร— + + ร— โˆˆ

} {

slide-53
SLIDE 53

Our Method: Overview

๐‘Œ โˆ’1 1 ๐‘„(๐‘ฆ)

... vpslld $20, ... vpshufd $114, ... vmulpd C1, ... vmulpd C2, ... ... 53

slide-54
SLIDE 54

Our Method: Overview

๐‘Œ โˆ’1 1 ๐‘„(๐‘ฆ)

... vpslld $20, ... vpshufd $114, ... vmulpd C1, ... vmulpd C2, ... ... 54

slide-55
SLIDE 55

Our Method: Overview

๐‘Œ โˆ’1 1 ๐‘„(๐‘ฆ)

... vpslld $20, ... vpshufd $114, ... vmulpd C1, ... vmulpd C2, ... ... 55

slide-56
SLIDE 56

Our Method: Overview

๐‘Œ โˆ’1 1 ๐‘„(๐‘ฆ)

... vpslld $20, ... vpshufd $114, ... vmulpd C1, ... vmulpd C2, ... ... 56

hard to find

slide-57
SLIDE 57

Our Method: Overview

๐‘Œ โˆ’1 1 ๐‘„(๐‘ฆ)

... vpslld $20, ... vpshufd $114, ... vmulpd C1, ... vmulpd C2, ... ... 57

hard to find abstract using n

slide-58
SLIDE 58

Our Method: Overview

๐‘Œ โˆ’1 1 ๐ฝ1 ๐ฝ2 ๐ฝ๐‘œ ๐‘„(๐‘ฆ)

... vpslld $20, ... vpshufd $114, ... vmulpd C1, ... vmulpd C2, ... ... 58

hard to find abstract using n

slide-59
SLIDE 59

Our Method: Overview

๐‘Œ โˆ’1 1 ๐ฝ1 ๐ฝ2 ๐ฝ๐‘œ ๐‘„(๐‘ฆ)

... vpslld $20, ... vpshufd $114, ... vmulpd C1, ... vmulpd C2, ... ... ... vpslld $20, ... vpshufd $114, ... vmulpd C1, ... vmulpd C2, ... ... ... vpslld $20, ... vpshufd $114, ... vmulpd C1, ... vmulpd C2, ... ... ... vpslld $20, ... vpshufd $114, ... vmulpd C1, ... vmulpd C2, ... ... 59

hard to find abstract using n

slide-60
SLIDE 60

Our Method: Overview

๐‘Œ โˆ’1 1 ๐ฝ1 ๐ฝ2 ๐ฝ๐‘œ ๐‘„(๐‘ฆ)

... vpslld $20, ... vpshufd $114, ... vmulpd C1, ... vmulpd C2, ... ... ... vpslld $20, ... vpshufd $114, ... vmulpd C1, ... vmulpd C2, ... ... ... vpslld $20, ... vpshufd $114, ... vmulpd C1, ... vmulpd C2, ... ... ... vpslld $20, ... vpshufd $114, ... vmulpd C1, ... vmulpd C2, ... ...

1 3 ๐’ ๐Ÿ‘๐’ + ๐Ÿ partial evaluation

  • f bit-level operations

60

hard to find abstract using n

slide-61
SLIDE 61

Our Method: Overview

๐‘Œ โˆ’1 1 ๐ฝ1 ๐ฝ2 ๐ฝ๐‘œ ๐‘„(๐‘ฆ)

... vpslld $20, ... vpshufd $114, ... vmulpd C1, ... vmulpd C2, ... ... ... vpslld $20, ... vpshufd $114, ... vmulpd C1, ... vmulpd C2, ... ... ... vpslld $20, ... vpshufd $114, ... vmulpd C1, ... vmulpd C2, ... ... ... vpslld $20, ... vpshufd $114, ... vmulpd C1, ... vmulpd C2, ... ...

1 3 ๐’ ๐Ÿ‘๐’ + ๐Ÿ partial evaluation

  • f bit-level operations

61

hard to find

  • nly floating-point
  • perations

abstract using n

slide-62
SLIDE 62

Our Method: Overview

๐ต1,๐œ€(๐‘ฆ) ๐ต๐‘œ,๐œ€(๐‘ฆ) ๐ต2,๐œ€(๐‘ฆ) ๐‘Œ โˆ’1 1 ๐ฝ1 ๐ฝ2 ๐ฝ๐‘œ ๐‘„(๐‘ฆ)

... vpslld $20, ... vpshufd $114, ... vmulpd C1, ... vmulpd C2, ... ... ... vpslld $20, ... vpshufd $114, ... vmulpd C1, ... vmulpd C2, ... ... ... vpslld $20, ... vpshufd $114, ... vmulpd C1, ... vmulpd C2, ... ... ... vpslld $20, ... vpshufd $114, ... vmulpd C1, ... vmulpd C2, ... ...

1 3 ๐’ ๐Ÿ‘๐’ + ๐Ÿ partial evaluation

  • f bit-level operations

62

hard to find

  • nly floating-point
  • perations

abstract using n

slide-63
SLIDE 63

Our Method: Overview

๐ต1,๐œ€(๐‘ฆ) ๐ต๐‘œ,๐œ€(๐‘ฆ) ๐ต2,๐œ€(๐‘ฆ) ๐ฝ1 ๐ฝ2 ๐ฝ๐‘œ

... vpslld $20, ... vpshufd $114, ... vmulpd C1, ... vmulpd C2, ... ... ... vpslld $20, ... vpshufd $114, ... vmulpd C1, ... vmulpd C2, ... ... ... vpslld $20, ... vpshufd $114, ... vmulpd C1, ... vmulpd C2, ... ...

1 3 ๐’ ๐Ÿ‘๐’ + ๐Ÿ partial evaluation

  • f bit-level operations

63

slide-64
SLIDE 64

Our Method: Overview

๐ฝ1 ๐ฝ2 ๐ฝ๐‘œ

๐‘” ๐‘ฆ โˆ’ ๐ต1,๐œ€ ๐‘ฆ ๐‘”(๐‘ฆ) ๐‘” ๐‘ฆ โˆ’ ๐ต๐‘œ,๐œ€ ๐‘ฆ ๐‘”(๐‘ฆ)

๐ต1,๐œ€(๐‘ฆ) ๐ต๐‘œ,๐œ€(๐‘ฆ) ๐ต2,๐œ€(๐‘ฆ) ๐ฝ1 ๐ฝ2 ๐ฝ๐‘œ

... vpslld $20, ... vpshufd $114, ... vmulpd C1, ... vmulpd C2, ... ... ... vpslld $20, ... vpshufd $114, ... vmulpd C1, ... vmulpd C2, ... ... ... vpslld $20, ... vpshufd $114, ... vmulpd C1, ... vmulpd C2, ... ...

1 3 ๐’ ๐Ÿ‘๐’ + ๐Ÿ partial evaluation

  • f bit-level operations

64

slide-65
SLIDE 65

Our Method: Overview

๐ฝ1 ๐ฝ2 ๐ฝ๐‘œ

๐‘” ๐‘ฆ โˆ’ ๐ต1,๐œ€ ๐‘ฆ ๐‘”(๐‘ฆ) ๐‘” ๐‘ฆ โˆ’ ๐ต๐‘œ,๐œ€ ๐‘ฆ ๐‘”(๐‘ฆ)

solve optimization problems

๐ต1,๐œ€(๐‘ฆ) ๐ต๐‘œ,๐œ€(๐‘ฆ) ๐ต2,๐œ€(๐‘ฆ) ๐ฝ1 ๐ฝ2 ๐ฝ๐‘œ

... vpslld $20, ... vpshufd $114, ... vmulpd C1, ... vmulpd C2, ... ... ... vpslld $20, ... vpshufd $114, ... vmulpd C1, ... vmulpd C2, ... ... ... vpslld $20, ... vpshufd $114, ... vmulpd C1, ... vmulpd C2, ... ...

1 3 ๐’ ๐Ÿ‘๐’ + ๐Ÿ partial evaluation

  • f bit-level operations

65

max max

slide-66
SLIDE 66

Our Method: Overview

๐ฝ1 ๐ฝ2 ๐ฝ๐‘œ

๐‘” ๐‘ฆ โˆ’ ๐ต1,๐œ€ ๐‘ฆ ๐‘”(๐‘ฆ) ๐‘” ๐‘ฆ โˆ’ ๐ต๐‘œ,๐œ€ ๐‘ฆ ๐‘”(๐‘ฆ)

answer!

solve optimization problems

๐ต1,๐œ€(๐‘ฆ) ๐ต๐‘œ,๐œ€(๐‘ฆ) ๐ต2,๐œ€(๐‘ฆ) ๐ฝ1 ๐ฝ2 ๐ฝ๐‘œ

... vpslld $20, ... vpshufd $114, ... vmulpd C1, ... vmulpd C2, ... ... ... vpslld $20, ... vpshufd $114, ... vmulpd C1, ... vmulpd C2, ... ... ... vpslld $20, ... vpshufd $114, ... vmulpd C1, ... vmulpd C2, ... ...

1 3 ๐’ ๐Ÿ‘๐’ + ๐Ÿ partial evaluation

  • f bit-level operations

66

max max

slide-67
SLIDE 67
  • Assume bit-level operations are used as well
  • To handle bit-level operations,

divide ๐‘Œ into intervals ๐ฝ๐‘™, so that,

  • n each ๐ฝ๐‘™,

we can statically know the result of each bit-level operation

  • Example:

2) Divide the Input Range

67

slide-68
SLIDE 68
  • Assume bit-level operations are used as well
  • To handle bit-level operations,

divide ๐‘Œ into intervals ๐ฝ๐‘™, so that,

  • n each ๐ฝ๐‘™,

we can statically know the result of each bit-level operation

  • Example:

2) Divide the Input Range

68

slide-69
SLIDE 69
  • Assume bit-level operations are used as well
  • To handle bit-level operations,

divide ๐‘Œ into intervals ๐ฝ๐‘™, so that,

  • n each ๐ฝ๐‘™,

we can statically know the result of each bit-level operation

  • Example:

input x y โ† x ร—f C

(C= 0x3ff71547652b82fe)

N โ† round(y) z โ† int(N) +i 0x3ff w โ† z << 52 ...

2) Divide the Input Range

โˆ’1 1 ๐‘Œ

69

slide-70
SLIDE 70
  • Assume bit-level operations are used as well
  • To handle bit-level operations,

divide ๐‘Œ into intervals ๐ฝ๐‘™, so that,

  • n each ๐ฝ๐‘™,

we can statically know the result of each bit-level operation

  • Example:

input x y โ† x ร—f C

(C= 0x3ff71547652b82fe)

N โ† round(y) z โ† int(N) +i 0x3ff w โ† z << 52 ...

2) Divide the Input Range

โˆ’1 1 ๐‘Œ ๐ฝโˆ’1 ๐ฝ0 ๐ฝ1

70

slide-71
SLIDE 71
  • Assume bit-level operations are used as well
  • To handle bit-level operations,

divide ๐‘Œ into intervals ๐ฝ๐‘™, so that,

  • n each ๐ฝ๐‘™,

we can statically know the result of each bit-level operation

  • Example:

input x y โ† x ร—f C

(C= 0x3ff71547652b82fe)

N โ† round(y) z โ† int(N) +i 0x3ff w โ† z << 52 ...

2) Divide the Input Range

โˆ’1 1 ๐‘Œ ๐ฝโˆ’1 ๐ฝ0 ๐ฝ1

71

๐ฝ1 ๐ฝ0 ๐‘Œ โˆ’1 1 ๐ฝโˆ’1

slide-72
SLIDE 72
  • Assume bit-level operations are used as well
  • To handle bit-level operations,

divide ๐‘Œ into intervals ๐ฝ๐‘™, so that,

  • n each ๐ฝ๐‘™,

we can statically know the result of each bit-level operation

  • Example:

input x y โ† x ร—f C

(C= 0x3ff71547652b82fe)

N โ† round(y) z โ† int(N) +i 0x3ff w โ† z << 52 ...

2) Divide the Input Range

โˆ’1 1 ๐‘Œ ๐ฝโˆ’1 ๐ฝ0 ๐ฝ1

72

๐ฝ1 ๐ฝ0 ๐‘Œ โˆ’1 1

โˆ’1

๐ฝโˆ’1

slide-73
SLIDE 73
  • Assume bit-level operations are used as well
  • To handle bit-level operations,

divide ๐‘Œ into intervals ๐ฝ๐‘™, so that,

  • n each ๐ฝ๐‘™,

we can statically know the result of each bit-level operation

  • Example:

input x y โ† x ร—f C

(C= 0x3ff71547652b82fe)

N โ† round(y) z โ† int(N) +i 0x3ff w โ† z << 52 ...

2) Divide the Input Range

โˆ’1 1 ๐‘Œ ๐ฝโˆ’1 ๐ฝ0 ๐ฝ1

73

๐ฝ1 ๐ฝ0 ๐‘Œ โˆ’1 1

โˆ’1 partial evaluation input x y โ† x ร—f C

(C= 0x3ff71547652b82fe)

N โ† โˆ’1 z โ† 1022 w โ† 0.5 ...

๐ฝโˆ’1

slide-74
SLIDE 74
  • Assume bit-level operations are used as well
  • To handle bit-level operations,

divide ๐‘Œ into intervals ๐ฝ๐‘™, so that,

  • n each ๐ฝ๐‘™,

we can statically know the result of each bit-level operation

  • Example:

input x y โ† x ร—f C

(C= 0x3ff71547652b82fe)

N โ† round(y) z โ† int(N) +i 0x3ff w โ† z << 52 ...

2) Divide the Input Range

โˆ’1 1 ๐‘Œ ๐ฝโˆ’1 ๐ฝ0 ๐ฝ1

74

๐ฝ1 ๐ฝ0 ๐‘Œ โˆ’1 1

โˆ’1 partial evaluation input x y โ† x ร—f C

(C= 0x3ff71547652b82fe)

N โ† โˆ’1 z โ† 1022 w โ† 0.5 ...

Only floating-point operations are left

โ†’ Can compute ๐ต๐œ€ ๐‘ฆ

  • n each ๐ฝ๐‘™

๐ฝโˆ’1

slide-75
SLIDE 75

2) Divide the Input Range

  • How to find such intervals?
  • Use symbolic abstractions
  • Example:
  • ๐‘‚ = round ๐‘ฆ ร—f C
  • (symbolic abstraction of ๐‘ฆ ร—f C) = ๐‘ฆ ร— C 1 + ๐œ€
  • Let ๐ฝ๐‘™ = largest interval contained in

๐‘ฆ โˆˆ ๐‘Œ โˆถ ๐‘‡ ๐‘ฆ โŠ‚ ๐‘™ โˆ’ 0.5, ๐‘™ + 0.5

  • Then ๐‘‚ is evaluated to ๐‘™ for every input in ๐ฝ๐‘™

75

slide-76
SLIDE 76

2) Divide the Input Range

  • How to find such intervals?
  • Use symbolic abstractions
  • Example:
  • ๐‘‚ = round ๐‘ฆ ร—f C
  • (symbolic abstraction of ๐‘ฆ ร—f C) = ๐‘ฆ ร— C 1 + ๐œ€
  • Let ๐ฝ๐‘™ = largest interval contained in

๐‘ฆ โˆˆ ๐‘Œ โˆถ ๐‘‡ ๐‘ฆ โŠ‚ ๐‘™ โˆ’ 0.5, ๐‘™ + 0.5

  • Then ๐‘‚ is evaluated to ๐‘™ for every input in ๐ฝ๐‘™

76

โˆ’1 1 ๐‘Œ ๐ฝโˆ’1 ๐ฝ0 ๐ฝ1

slide-77
SLIDE 77

2) Divide the Input Range

  • How to find such intervals?
  • Use symbolic abstractions
  • Example:
  • ๐‘‚ = round ๐‘ฆ ร—f C
  • (symbolic abstraction of ๐‘ฆ ร—f C) = ๐‘ฆ ร— C 1 + ๐œ€
  • Let ๐ฝ๐‘™ = largest interval contained in

๐‘ฆ โˆˆ ๐‘Œ โˆถ ๐‘‡ ๐‘ฆ โŠ‚ ๐‘™ โˆ’ 0.5, ๐‘™ + 0.5

  • Then ๐‘‚ is evaluated to ๐‘™ for every input in ๐ฝ๐‘™

77

๐‘‚ = โˆ’1 ๐‘‚ = 0 ๐‘‚ = 1 โˆ’1 1 ๐‘Œ ๐ฝโˆ’1 ๐ฝ0 ๐ฝ1

slide-78
SLIDE 78

2) Divide the Input Range

  • How to find such intervals?
  • Use symbolic abstractions
  • Example:
  • ๐‘‚ = round ๐‘ฆ ร—f C
  • (symbolic abstraction of ๐‘ฆ ร—f C) = ๐‘ฆ ร— C 1 + ๐œ€
  • Let ๐ฝ๐‘™ = largest interval contained in

๐‘ฆ โˆˆ ๐‘Œ โˆถ ๐‘‡ ๐‘ฆ โŠ‚ ๐‘™ โˆ’ 0.5, ๐‘™ + 0.5

  • Then ๐‘‚ is evaluated to ๐‘™ for every input in ๐ฝ๐‘™

78

๐‘‚ = โˆ’1 ๐‘‚ = 0 ๐‘‚ = 1 โˆ’1 1 ๐‘Œ ๐ฝโˆ’1 ๐ฝ0 ๐ฝ1

slide-79
SLIDE 79

2) Divide the Input Range

  • How to find such intervals?
  • Use symbolic abstractions
  • Example:
  • ๐‘‚ = round ๐‘ฆ ร—f C
  • (symbolic abstraction of ๐‘ฆ ร—f C) = ๐‘ฆ ร— C 1 + ๐œ€
  • Let ๐ฝ๐‘™ = largest interval contained in

๐‘ฆ โˆˆ ๐‘Œ โˆถ ๐‘‡ ๐‘ฆ โŠ‚ ๐‘™ โˆ’ 0.5, ๐‘™ + 0.5

  • Then ๐‘‚ is evaluated to ๐‘™ for every input in ๐ฝ๐‘™

79

๐‘‚ = โˆ’1 ๐‘‚ = 0 ๐‘‚ = 1 โˆ’1 1 ๐‘Œ ๐ฝโˆ’1 ๐ฝ0 ๐ฝ1

slide-80
SLIDE 80

2) Divide the Input Range

  • How to find such intervals?
  • Use symbolic abstractions
  • Example:
  • ๐‘‚ = round ๐‘ฆ ร—f C
  • (symbolic abstraction of ๐‘ฆ ร—f C) = ๐‘ฆ ร— C 1 + ๐œ€
  • Let ๐ฝ๐‘™ = largest interval contained in

๐‘ฆ โˆˆ ๐‘Œ โˆถ ๐‘‡ ๐‘ฆ โŠ‚ ๐‘™ โˆ’ 0.5, ๐‘™ + 0.5

  • Then ๐‘‚ is evaluated to ๐‘™ for every input in ๐ฝ๐‘™

80

๐‘‚ = โˆ’1 ๐‘‚ = 0 ๐‘‚ = 1 โˆ’1 1 ๐‘Œ ๐ฝโˆ’1 ๐ฝ0 ๐ฝ1

slide-81
SLIDE 81

2) Divide the Input Range

  • How to find such intervals?
  • Use symbolic abstractions
  • Example:
  • ๐‘‚ = round ๐‘ฆ ร—f C
  • (symbolic abstraction of ๐‘ฆ ร—f C) = ๐‘ฆ ร— C 1 + ๐œ€
  • Let ๐ฝ๐‘™ = largest interval contained in

๐‘ฆ โˆˆ ๐‘Œ โˆถ ๐‘‡ ๐‘ฆ โŠ‚ ๐‘™ โˆ’ 0.5, ๐‘™ + 0.5

  • Then ๐‘‚ is evaluated to ๐‘™ for every input in ๐ฝ๐‘™

๐‘‡(๐‘ฆ) = ๐‘ฆ ร— C 1 + ๐œ€ : ๐œ€ < ๐œ— ๐‘ฆ ร—f C

81

๐‘‚ = โˆ’1 ๐‘‚ = 0 ๐‘‚ = 1 โˆ’1 1 ๐‘Œ ๐ฝโˆ’1 ๐ฝ0 ๐ฝ1

slide-82
SLIDE 82

2) Divide the Input Range

  • How to find such intervals?
  • Use symbolic abstractions
  • Example:
  • ๐‘‚ = round ๐‘ฆ ร—f C
  • (symbolic abstraction of ๐‘ฆ ร—f C) = ๐‘ฆ ร— C 1 + ๐œ€
  • Let ๐ฝ๐‘™ = largest interval contained in

๐‘ฆ โˆˆ ๐‘Œ โˆถ ๐‘‡ ๐‘ฆ โŠ‚ ๐‘™ โˆ’ 0.5, ๐‘™ + 0.5

  • Then ๐‘‚ is evaluated to ๐‘™ for every input in ๐ฝ๐‘™

๐‘‡(๐‘ฆ) = ๐‘ฆ ร— C 1 + ๐œ€ : ๐œ€ < ๐œ— ๐‘ฆ ร—f C ๐‘™ โˆ’ 0.5 ๐‘™ + 0.5

82

๐‘‚ = โˆ’1 ๐‘‚ = 0 ๐‘‚ = 1 โˆ’1 1 ๐‘Œ ๐ฝโˆ’1 ๐ฝ0 ๐ฝ1

slide-83
SLIDE 83

2) Divide the Input Range

  • How to find such intervals?
  • Use symbolic abstractions
  • Example:
  • ๐‘‚ = round ๐‘ฆ ร—f C
  • (symbolic abstraction of ๐‘ฆ ร—f C) = ๐‘ฆ ร— C 1 + ๐œ€
  • Let ๐ฝ๐‘™ = largest interval contained in

๐‘ฆ โˆˆ ๐‘Œ โˆถ ๐‘‡ ๐‘ฆ โŠ‚ ๐‘™ โˆ’ 0.5, ๐‘™ + 0.5

  • Then ๐‘‚ is evaluated to ๐‘™ for every input in ๐ฝ๐‘™

๐‘‡(๐‘ฆ) = ๐‘ฆ ร— C 1 + ๐œ€ : ๐œ€ < ๐œ— ๐‘ฆ ร—f C ๐‘™ โˆ’ 0.5 ๐‘™ + 0.5

83

๐‘‚ = โˆ’1 ๐‘‚ = 0 ๐‘‚ = 1 โˆ’1 1 ๐‘Œ ๐ฝโˆ’1 ๐ฝ0 ๐ฝ1

๐‘‚ = ๐‘™

slide-84
SLIDE 84

2) Divide the Input Range

  • How to find such intervals?
  • Use symbolic abstractions
  • Example:
  • ๐‘‚ = round ๐‘ฆ ร—f C
  • (symbolic abstraction of ๐‘ฆ ร—f C) = ๐‘ฆ ร— C 1 + ๐œ€
  • Let ๐ฝ๐‘™ = largest interval contained in

๐‘ฆ โˆˆ ๐‘Œ โˆถ ๐‘‡ ๐‘ฆ โŠ‚ ๐‘™ โˆ’ 0.5, ๐‘™ + 0.5

  • Then ๐‘‚ is evaluated to ๐‘™ for every input in ๐ฝ๐‘™

๐‘‡(๐‘ฆ) = ๐‘ฆ ร— C 1 + ๐œ€ : ๐œ€ < ๐œ— ๐‘ฆ ร—f C ๐‘™ โˆ’ 0.5 ๐‘™ + 0.5

84

๐‘‚ = โˆ’1 ๐‘‚ = 0 ๐‘‚ = 1 โˆ’1 1 ๐‘Œ ๐ฝโˆ’1 ๐ฝ0 ๐ฝ1

๐‘‚ = ๐‘™

slide-85
SLIDE 85

2) Divide the Input Range

  • How to find such intervals?
  • Use symbolic abstractions
  • Example:
  • ๐‘‚ = round ๐‘ฆ ร—f C
  • (symbolic abstraction of ๐‘ฆ ร—f C) = ๐‘ฆ ร— C 1 + ๐œ€
  • Let ๐ฝ๐‘™ = largest interval contained in

๐‘ฆ โˆˆ ๐‘Œ โˆถ ๐‘‡ ๐‘ฆ โŠ‚ ๐‘™ โˆ’ 0.5, ๐‘™ + 0.5

  • Then ๐‘‚ is evaluated to ๐‘™ for every input in ๐ฝ๐‘™

๐‘‡(๐‘ฆ) = ๐‘ฆ ร— C 1 + ๐œ€ : ๐œ€ < ๐œ— ๐‘ฆ ร—f C ๐‘™ โˆ’ 0.5 ๐‘™ + 0.5

85

๐‘‚ = โˆ’1 ๐‘‚ = 0 ๐‘‚ = 1 โˆ’1 1 ๐‘Œ ๐ฝโˆ’1 ๐ฝ0 ๐ฝ1

๐‘‚ = ๐‘™

slide-86
SLIDE 86

3) Compute a Bound on Precision Loss

  • Precision loss on each interval ๐ฝ๐‘™
  • Let ๐ต๐œ€ ๐‘ฆ

be a symbolic abstraction on ๐ฝ๐‘™

  • Analytical optimization:

max

๐‘ฆโˆˆ๐ฝ๐‘™, |๐œ€๐‘—|<๐œ— ๐‘“๐‘ฆโˆ’๐ต๐œ€ ๐‘ฆ ๐‘“๐‘ฆ

  • Use Mathematica to solve optimization problems analytically

86

slide-87
SLIDE 87

3) Compute a Bound on Precision Loss

  • Precision loss on each interval ๐ฝ๐‘™
  • Let ๐ต๐œ€ ๐‘ฆ

be a symbolic abstraction on ๐ฝ๐‘™

  • Analytical optimization:

max

๐‘ฆโˆˆ๐ฝ๐‘™, |๐œ€๐‘—|<๐œ— ๐‘“๐‘ฆโˆ’๐ต๐œ€ ๐‘ฆ ๐‘“๐‘ฆ

  • Use Mathematica to solve optimization problems analytically

87

slide-88
SLIDE 88
  • No.

The constructed intervals do not cover ๐‘Œ in general

  • Because we made sound approximations

Are We Done?

โˆ’1 1

input range ๐‘Œ

๐ฝโˆ’1 ๐ฝ0 ๐ฝ1

88

slide-89
SLIDE 89
  • No.

The constructed intervals do not cover ๐‘Œ in general

  • Because we made sound approximations

Are We Done?

โˆ’1 1

input range ๐‘Œ

๐ฝโˆ’1 ๐ฝ0 ๐ฝ1

89

floating-point numbers

slide-90
SLIDE 90
  • No.

The constructed intervals do not cover ๐‘Œ in general

  • Because we made sound approximations

Are We Done?

โˆ’1 1

input range ๐‘Œ

๐ฝโˆ’1 ๐ฝ0 ๐ฝ1

90

floating-point numbers between intervals

slide-91
SLIDE 91
  • No.

The constructed intervals do not cover ๐‘Œ in general

  • Because we made sound approximations

Are We Done?

โˆ’1 1

input range ๐‘Œ

๐ฝโˆ’1 ๐ฝ0 ๐ฝ1

91

floating-point numbers between intervals

slide-92
SLIDE 92
  • Example:

๐‘‚ = round ๐‘ฆ ร—f ๐ท

For ๐‘ฆ =

1 2๐ท ,

๐‘‚ would be 0 or 1

  • Let ๐ผ = {floating-
  • We observe that |๐ผ| is small in experiment

Are We Done?

0.5 1

92

: abstraction of ๐‘ฆ ร—f ๐ท

slide-93
SLIDE 93
  • Example:

๐‘‚ = round ๐‘ฆ ร—f ๐ท

For ๐‘ฆ =

1 2๐ท ,

๐‘‚ would be 0 or 1

  • Let ๐ผ = {floating-
  • We observe that |๐ผ| is small in experiment

Are We Done?

0.5 1

93

: abstraction of ๐‘ฆ ร—f ๐ท

๐‘ฆ = 1/(3๐ท) ๐‘ฆ = 1/(1.5๐ท)

slide-94
SLIDE 94
  • Example:

๐‘‚ = round ๐‘ฆ ร—f ๐ท

For ๐‘ฆ =

1 2๐ท ,

๐‘‚ would be 0 or 1

  • Let ๐ผ = {floating-
  • We observe that |๐ผ| is small in experiment

Are We Done?

0.5 1

94

: abstraction of ๐‘ฆ ร—f ๐ท

๐‘ฆ = 1/(3๐ท) ๐‘ฆ = 1/(1.5๐ท)

๐‘‚ = 0 ๐‘‚ = 1

slide-95
SLIDE 95
  • Example:

๐‘‚ = round ๐‘ฆ ร—f ๐ท

For ๐‘ฆ =

1 2๐ท ,

๐‘‚ would be 0 or 1

  • Let ๐ผ = {floating-
  • We observe that |๐ผ| is small in experiment

Are We Done?

0.5 1

95

: abstraction of ๐‘ฆ ร—f ๐ท

๐‘ฆ = 1/(3๐ท) ๐‘ฆ = 1/(1.5๐ท) ๐‘ฆ = 1/(2๐ท)

๐‘‚ = 0 ๐‘‚ = 1

slide-96
SLIDE 96
  • Example:

๐‘‚ = round ๐‘ฆ ร—f ๐ท

For ๐‘ฆ =

1 2๐ท ,

๐‘‚ would be 0 or 1

  • Let ๐ผ = {floating-
  • We observe that |๐ผ| is small in experiment

Are We Done?

๐‘ฆ ร—f ๐ท 0.5 1

? ? ? ? ? ?

96

: abstraction of ๐‘ฆ ร—f ๐ท

๐‘ฆ = 1/(3๐ท) ๐‘ฆ = 1/(1.5๐ท) ๐‘ฆ = 1/(2๐ท)

๐‘‚ = 0 ๐‘‚ = 1

slide-97
SLIDE 97
  • Example:

๐‘‚ = round ๐‘ฆ ร—f ๐ท

For ๐‘ฆ =

1 2๐ท ,

๐‘‚ would be 0 or 1

  • Let ๐ผ = {floating-
  • We observe that |๐ผ| is small in experiment

Are We Done?

๐‘ฆ ร—f ๐ท 0.5 1

? ? ? ? ? ?

97

: abstraction of ๐‘ฆ ร—f ๐ท

๐‘ฆ = 1/(3๐ท) ๐‘ฆ = 1/(1.5๐ท) ๐‘ฆ = 1/(2๐ท)

๐‘‚ = 0 ๐‘‚ = 1

slide-98
SLIDE 98
  • Example:

๐‘‚ = round ๐‘ฆ ร—f ๐ท

For ๐‘ฆ =

1 2๐ท ,

๐‘‚ would be 0 or 1

  • Let ๐ผ = {floating-
  • We observe that |๐ผ| is small in experiment

Are We Done?

๐‘ฆ ร—f ๐ท 0.5 1

? ? ? ? ? ?

98

: abstraction of ๐‘ฆ ร—f ๐ท

๐‘ฆ = 1/(3๐ท) ๐‘ฆ = 1/(1.5๐ท) ๐‘ฆ = 1/(2๐ท)

๐‘‚ = 0 ๐‘‚ = 1

slide-99
SLIDE 99

3) Compute a Bound on Precision Loss

  • Precision loss on each interval ๐ฝ๐‘™
  • Let ๐ต๐œ€ ๐‘ฆ

be a symbolic abstraction on ๐ฝ๐‘™

  • Analytical optimization:

max

๐‘ฆโˆˆ๐ฝ๐‘™, |๐œ€๐‘—|<๐œ— ๐‘“๐‘ฆโˆ’๐ต๐œ€ ๐‘ฆ ๐‘“๐‘ฆ

  • Use Mathematica to solve optimization problems analytically
  • Precision loss on ๐ผ
  • For each ๐‘ฆ โˆˆ ๐ผ,
  • btain ๐‘„ ๐‘ฆ by executing the binary
  • Brute force:

max

๐‘ฆโˆˆ๐ผ ๐‘“๐‘ฆโˆ’๐‘„ ๐‘ฆ ๐‘“๐‘ฆ

  • Use Mathematica to compute ๐‘“๐‘ฆ and precision loss exactly

99

slide-100
SLIDE 100

3) Compute a Bound on Precision Loss

  • Precision loss on each interval ๐ฝ๐‘™
  • Let ๐ต๐œ€ ๐‘ฆ

be a symbolic abstraction on ๐ฝ๐‘™

  • Analytical optimization:

max

๐‘ฆโˆˆ๐ฝ๐‘™, |๐œ€๐‘—|<๐œ— ๐‘“๐‘ฆโˆ’๐ต๐œ€ ๐‘ฆ ๐‘“๐‘ฆ

  • Use Mathematica to solve optimization problems analytically
  • Precision loss on ๐ผ
  • For each ๐‘ฆ โˆˆ ๐ผ,
  • btain ๐‘„ ๐‘ฆ by executing the binary
  • Brute force:

max

๐‘ฆโˆˆ๐ผ ๐‘“๐‘ฆโˆ’๐‘„ ๐‘ฆ ๐‘“๐‘ฆ

  • Use Mathematica to compute ๐‘“๐‘ฆ and precision loss exactly

take maximum

โ†’ answer!

100

slide-101
SLIDE 101

Case Studies

101

slide-102
SLIDE 102

Settings

  • Benchmarks
  • exp:

from S3D (a combustion simulation engine)

  • sin,

log: from

<math.h>

  • Measures of precision loss
  • Relative error:

RelErr(๐‘, ๐‘) =

๐‘โˆ’๐‘ ๐‘

  • ULP error:
  • Rounding errors of numeric libraries are typically measured by ULPs
  • ULPErr ๐‘, ๐‘ = (# of floating-point numbers between ๐‘ and ๐‘)
  • Example:
  • ULPErr ๐‘, ๐‘ โ‰ค 2 โˆ™ RelErr(๐‘, ๐‘)/๐œ—

102

slide-103
SLIDE 103

Settings

  • Benchmarks
  • exp:

from S3D (a combustion simulation engine)

  • sin,

log: from

<math.h>

  • Measures of precision loss
  • Relative error:

RelErr(๐‘, ๐‘) =

๐‘โˆ’๐‘ ๐‘

  • ULP error:
  • Rounding errors of numeric libraries are typically measured by ULPs
  • ULPErr ๐‘, ๐‘ = (# of floating-point numbers between ๐‘ and ๐‘)
  • Example:
  • ULPErr ๐‘, ๐‘ โ‰ค 2 โˆ™ RelErr(๐‘, ๐‘)/๐œ—

103

5 ULPs

๐‘ ๐‘

slide-104
SLIDE 104

Results

Interval Bound on ULP error # of intervals # of

๐œ€

Size of

exp [โˆ’4, 4] 14 13 29 36 sin โˆ’ ๐œŒ 2 , ๐œŒ 2 9 33 53 110 log (0,4) โˆ– 4095 4096 , 1 21 221 25 4095 4096 , 1 1 ร— 1014 1 25

104

slide-105
SLIDE 105

Results

Interval Bound on ULP error # of intervals # of

๐œ€

Size of

exp [โˆ’4, 4] 14 13 29 36 sin โˆ’ ๐œŒ 2 , ๐œŒ 2 9 33 53 110 log (0,4) โˆ– 4095 4096 , 1 21 221 25 4095 4096 , 1 1 ร— 1014 1 25

105

best illustrates the power of our method

slide-106
SLIDE 106

Results: sin, log

x-axis: input value y-axis: ULP error

bounds on the intervals

sin log

106 1014

โ‹ฎ

slide-107
SLIDE 107

Results: sin, log

x-axis: input value y-axis: ULP error

bounds on the intervals

sin log

107 1014

โ‹ฎ

slide-108
SLIDE 108

Limitations of Our Method

  • May construct a large number of intervals
  • Example:

0x5fe6eb50c7b537a9 โ€“ (x >> 1)

  • For this example,
  • ur method constructs 263 intervals
  • May produce loose error bounds
  • Example:

1014 ULPs for log on

4095 4096 , 1

  • Sometimes 1 + ๐œ—

property provides an imprecise abstraction

  • Proving a precise error bound requires more sophisticated

error analysis beyond 1 + ๐œ— property

  • Our recent result:

6 ULPs for for log on 0,4

108

slide-109
SLIDE 109

Limitations of Our Method

  • May construct a large number of intervals
  • Example:

0x5fe6eb50c7b537a9 โ€“ (x >> 1)

  • For this example,
  • ur method constructs 263 intervals
  • May produce loose error bounds
  • Example:

1014 ULPs for log on

4095 4096 , 1

  • Sometimes 1 + ๐œ—

property provides an imprecise abstraction

  • Proving a precise error bound requires more sophisticated

error analysis beyond 1 + ๐œ— property

  • Our recent result:

6 ULPs for for log on 0,4

109

slide-110
SLIDE 110

Summary

  • First systematic method for verifying binaries

that mix floating-point and bit-level operations

  • Use abstraction,

analytical optimization, and testing

  • Directly applicable to highly optimized binaries
  • f transcendental functions

110

slide-111
SLIDE 111

Questions?

111