Verifying Bit-Manipulations
- f Floating-P
- int
Wonyeol Lee
Rahul Sharma Alex Aiken Stanford University PLDI 2016
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
Wonyeol Lee
Rahul Sharma Alex Aiken Stanford University PLDI 2016
Bound the difference between spec and implementation
Verify binaries that mix floating-point and bit- level operations
mathematical specification
2
Bound the difference between spec and implementation
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
Bound the difference between spec and implementation
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
Bound the difference between spec and implementation
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
Bound the difference between spec and implementation
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
Bound the difference between spec and implementation
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
Bound the difference between spec and implementation
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
1 + 1030 โ 1030 = 1 โ 0 = (1 + 1030) โ 1030
9
1 01111111111 1100โฏ00 (2) = โ1 1 โ 21023โ1023 โ 1.110 โฏ 00(2)
1 + 1030 โ 1030 = 1 โ 0 = (1 + 1030) โ 1030
10
1 01111111111 1100โฏ00 (2) = โ1 1 โ 21023โ1023 โ 1.110 โฏ 00(2)
1 + 1030 โ 1030 = 1 โ 0 = (1 + 1030) โ 1030
11
1 01111111111 1100โฏ00 (2) = โ1 1 โ 21023โ1023 โ 1.110 โฏ 00(2)
Given ๐ (in int), compute 2๐ (in double)
floating-point implementations
reasoning about the code is difficult
12
Given ๐ (in int), compute 2๐ (in double)
floating-point implementations
reasoning about the code is difficult
1 [int] 2๐ [int] 2๐ [double]
bit-shifting by ๐ converting from int to double here ๐ = 10
13
Given ๐ (in int), compute 2๐ (in double)
floating-point implementations
reasoning about the code is difficult
1 [int] 2๐ [int] 2๐ [double]
bit-shifting by ๐ converting from int to double here ๐ = 10
14
expensive
Given ๐ (in int), compute 2๐ (in double)
floating-point implementations
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
Given ๐ (in int), compute 2๐ (in double)
floating-point implementations
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
Given ๐ (in int), compute 2๐ (in double)
floating-point implementations
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
Given ๐ (in int), compute 2๐ (in double)
floating-point implementations
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
Given ๐ (in int), compute 2๐ (in double)
floating-point implementations
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
Find a small ฮ > 0 such that
๐ ๐ฆ โ๐ ๐ฆ ๐(๐ฆ)
โค ฮ for all ๐ฆ โ ๐
prove a bound on the maximum precision loss
mathematical specification
๐: โ โ โ
20
Find a small ฮ > 0 such that
๐ ๐ฆ โ๐ ๐ฆ ๐(๐ฆ)
โค ฮ for all ๐ฆ โ ๐
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
Find a small ฮ > 0 such that
๐ ๐ฆ โ๐ ๐ฆ ๐(๐ฆ)
โค ฮ for all ๐ฆ โ ๐
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
Find a small ฮ > 0 such that
๐ ๐ฆ โ๐ ๐ฆ ๐(๐ฆ)
โค ฮ for all ๐ฆ โ ๐
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
~ 30 seconds (with 1 core for sinf)
> 4000 years (= 30 seconds ร 232)
โต (# of doubles between โ1 and 1) =
1 2 (# of all doubles)
transcendental functions are very accurate [
]
persistence
24
~ 30 seconds (with 1 core for sinf)
> 4000 years (= 30 seconds ร 232)
โต (# of doubles between โ1 and 1) =
1 2 (# of all doubles)
transcendental functions are very accurate [
]
persistence
25
~ 30 seconds (with 1 core for sinf)
> 4000 years (= 30 seconds ร 232)
โต (# of doubles between โ1 and 1) =
1 2 (# of all doubles)
transcendental functions are very accurate [
]
persistence
26
~ 30 seconds (with 1 core for sinf)
> 4000 years (= 30 seconds ร 232)
โต (# of doubles between โ1 and 1) =
1 2 (# of all doubles)
transcendental functions are very accurate [
]
persistence.
27
various automatic techniques can be applied
Astree , Fluctuat , ROSA , FPTaylor
Astree, Fluctuat) can handle certain bit-trick routines
mixed floating-point and bit-level code
28
various automatic techniques can be applied
Astree , Fluctuat , ROSA , FPTaylor
Astree, Fluctuat) can handle certain bit-trick routines
mixed floating-point and bit-level code
29
30
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
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
๐ = round ๐ฆ โ log2 ๐ ๐ฆ
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
2๐
๐ = round ๐ฆ โ log2 ๐ ๐ฆ
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
๐๐ฆ = ๐๐โln 2 โ ๐๐ โ 2๐ โ ๐๐ ๐๐ โ เท
๐=0 12 ๐ ๐
๐! ๐ = ๐ฆ โ ๐ โ ln 2 2๐
๐ = round ๐ฆ โ log2 ๐ ๐ฆ
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๐
๐ = round ๐ฆ โ log2 ๐ ๐ฆ
Goal: Find a small ฮ > 0 such that
๐๐ฆโ2๐๐๐ ๐๐ฆ
โค ฮ for all ๐ฆ โ ๐
35
property
๐ = 2โ53
(FPTaylor
36
property
๐ = 2โ53
(FPTaylor
37
property
๐ = 2โ53
(FPTaylor
๐ฆ โจf ๐ง โ ๐ฆโจ๐ง 1 + ๐ โถ ๐ < ๐
38
property
๐ = 2โ53
(FPTaylor
๐ฆ โจf ๐ง โ ๐ฆโจ๐ง 1 + ๐ โถ ๐ < ๐
39
๐ฆโจ๐ง
1
property
๐ = 2โ53
(FPTaylor
๐ฆ โจf ๐ง โ ๐ฆโจ๐ง 1 + ๐ โถ ๐ < ๐
40
๐ฆโจ๐ง
1
property
๐ = 2โ53
(FPTaylor
๐ฆ โจf ๐ง โ ๐ฆโจ๐ง 1 + ๐ โถ ๐ < ๐
41
๐ฆ โจf ๐ง ๐ฆโจ๐ง
1
property
๐ = 2โ53
(FPTaylor
๐ฆ โจf ๐ง โ ๐ฆโจ๐ง 1 + ๐ โถ ๐ < ๐
42
๐ฆ โจf ๐ง ๐ฆโจ๐ง
1
๐
property
๐ = 2โ53
(FPTaylor
๐ฆ โจf ๐ง โ ๐ฆโจ๐ง 1 + ๐ โถ ๐ < ๐
43
๐ฆ โจf ๐ง ๐ฆโจ๐ง
1
๐
rom 1 + ๐ property, ๐ต๐ ๐ฆ satisfies
๐ ๐ฆ โ ๐ต๐ ๐ฆ โถ ๐๐ < ๐ for all ๐ฆ
44
rom 1 + ๐ property, ๐ต๐ ๐ฆ satisfies
๐ ๐ฆ โ ๐ต๐ ๐ฆ โถ ๐๐ < ๐ for all ๐ฆ
45
๐ ๐ฆ = 2 รf ๐ฆ 1 + ๐1 +f 3 1 + ๐2
rom 1 + ๐ property, ๐ต๐ ๐ฆ satisfies
๐ ๐ฆ โ ๐ต๐ ๐ฆ โถ ๐๐ < ๐ for all ๐ฆ
46
๐ ๐ฆ = 2 รf ๐ฆ 1 + ๐1 +f 3 1 + ๐2 ๐ต๐ ๐ฆ
rom 1 + ๐ property, ๐ต๐ ๐ฆ satisfies
๐ ๐ฆ โ ๐ต๐ ๐ฆ โถ ๐๐ < ๐ for all ๐ฆ
47
๐ ๐ฆ = 2 รf ๐ฆ 1 + ๐1 +f 3 1 + ๐2 ๐ต๐ ๐ฆ ร +
rom 1 + ๐ property, ๐ต๐ ๐ฆ satisfies
๐ ๐ฆ โ ๐ต๐ ๐ฆ โถ ๐๐ < ๐ for all ๐ฆ
48
๐ ๐ฆ = 2 รf ๐ฆ 1 + ๐1 +f 3 1 + ๐2 ๐ต๐ ๐ฆ ร +
rom 1 + ๐ property, ๐ต๐ ๐ฆ satisfies
๐ ๐ฆ โ ๐ต๐ ๐ฆ โถ ๐๐ < ๐ for all ๐ฆ
49
๐ ๐ฆ = 2 รf ๐ฆ 1 + ๐1 +f 3 1 + ๐2 ๐ต๐ ๐ฆ ร +
rom 1 + ๐ property, ๐ต๐ ๐ฆ satisfies
๐ ๐ฆ โ ๐ต๐ ๐ฆ โถ ๐๐ < ๐ for all ๐ฆ
๐ ๐ฆ = 2 รf ๐ฆ 1 + ๐1 +f 3 1 + ๐2 โถ ๐1 , ๐2 < ๐
50
๐ ๐ฆ = 2 รf ๐ฆ 1 + ๐1 +f 3 1 + ๐2 ๐ต๐ ๐ฆ ร +
rom 1 + ๐ property, ๐ต๐ ๐ฆ satisfies
๐ ๐ฆ โ ๐ต๐ ๐ฆ โถ ๐๐ < ๐ for all ๐ฆ
๐ ๐ฆ = 2 รf ๐ฆ 1 + ๐1 +f 3 1 + ๐2 โถ ๐1 , ๐2 < ๐
51
๐ ๐ฆ = 2 รf ๐ฆ 1 + ๐1 +f 3 1 + ๐2 ๐ต๐ ๐ฆ ร + + ร
} {
rom 1 + ๐ property, ๐ต๐ ๐ฆ satisfies
๐ ๐ฆ โ ๐ต๐ ๐ฆ โถ ๐๐ < ๐ for all ๐ฆ
๐ ๐ฆ = 2 รf ๐ฆ 1 + ๐1 +f 3 1 + ๐2 โถ ๐1 , ๐2 < ๐
52
๐ ๐ฆ = 2 รf ๐ฆ 1 + ๐1 +f 3 1 + ๐2 ๐ต๐ ๐ฆ ร + + ร โ
} {
๐ โ1 1 ๐(๐ฆ)
... vpslld $20, ... vpshufd $114, ... vmulpd C1, ... vmulpd C2, ... ... 53
๐ โ1 1 ๐(๐ฆ)
... vpslld $20, ... vpshufd $114, ... vmulpd C1, ... vmulpd C2, ... ... 54
๐ โ1 1 ๐(๐ฆ)
... vpslld $20, ... vpshufd $114, ... vmulpd C1, ... vmulpd C2, ... ... 55
๐ โ1 1 ๐(๐ฆ)
... vpslld $20, ... vpshufd $114, ... vmulpd C1, ... vmulpd C2, ... ... 56
hard to find
๐ โ1 1 ๐(๐ฆ)
... vpslld $20, ... vpshufd $114, ... vmulpd C1, ... vmulpd C2, ... ... 57
hard to find abstract using n
๐ โ1 1 ๐ฝ1 ๐ฝ2 ๐ฝ๐ ๐(๐ฆ)
... vpslld $20, ... vpshufd $114, ... vmulpd C1, ... vmulpd C2, ... ... 58
hard to find abstract using n
๐ โ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
๐ โ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
60
hard to find abstract using n
๐ โ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
61
hard to find
abstract using n
๐ต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
62
hard to find
abstract using n
๐ต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
63
๐ฝ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
64
๐ฝ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
65
max max
๐ฝ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
66
max max
divide ๐ into intervals ๐ฝ๐, so that,
we can statically know the result of each bit-level operation
67
divide ๐ into intervals ๐ฝ๐, so that,
we can statically know the result of each bit-level operation
68
divide ๐ into intervals ๐ฝ๐, so that,
we can statically know the result of each bit-level operation
input x y โ x รf C
(C= 0x3ff71547652b82fe)
N โ round(y) z โ int(N) +i 0x3ff w โ z << 52 ...
โ1 1 ๐
69
divide ๐ into intervals ๐ฝ๐, so that,
we can statically know the result of each bit-level operation
input x y โ x รf C
(C= 0x3ff71547652b82fe)
N โ round(y) z โ int(N) +i 0x3ff w โ z << 52 ...
โ1 1 ๐ ๐ฝโ1 ๐ฝ0 ๐ฝ1
70
divide ๐ into intervals ๐ฝ๐, so that,
we can statically know the result of each bit-level operation
input x y โ x รf C
(C= 0x3ff71547652b82fe)
N โ round(y) z โ int(N) +i 0x3ff w โ z << 52 ...
โ1 1 ๐ ๐ฝโ1 ๐ฝ0 ๐ฝ1
71
๐ฝ1 ๐ฝ0 ๐ โ1 1 ๐ฝโ1
divide ๐ into intervals ๐ฝ๐, so that,
we can statically know the result of each bit-level operation
input x y โ x รf C
(C= 0x3ff71547652b82fe)
N โ round(y) z โ int(N) +i 0x3ff w โ z << 52 ...
โ1 1 ๐ ๐ฝโ1 ๐ฝ0 ๐ฝ1
72
๐ฝ1 ๐ฝ0 ๐ โ1 1
โ1
๐ฝโ1
divide ๐ into intervals ๐ฝ๐, so that,
we can statically know the result of each bit-level operation
input x y โ x รf C
(C= 0x3ff71547652b82fe)
N โ round(y) z โ int(N) +i 0x3ff w โ z << 52 ...
โ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
divide ๐ into intervals ๐ฝ๐, so that,
we can statically know the result of each bit-level operation
input x y โ x รf C
(C= 0x3ff71547652b82fe)
N โ round(y) z โ int(N) +i 0x3ff w โ z << 52 ...
โ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 ๐ต๐ ๐ฆ
๐ฝโ1
๐ฆ โ ๐ โถ ๐ ๐ฆ โ ๐ โ 0.5, ๐ + 0.5
75
๐ฆ โ ๐ โถ ๐ ๐ฆ โ ๐ โ 0.5, ๐ + 0.5
76
โ1 1 ๐ ๐ฝโ1 ๐ฝ0 ๐ฝ1
๐ฆ โ ๐ โถ ๐ ๐ฆ โ ๐ โ 0.5, ๐ + 0.5
77
๐ = โ1 ๐ = 0 ๐ = 1 โ1 1 ๐ ๐ฝโ1 ๐ฝ0 ๐ฝ1
๐ฆ โ ๐ โถ ๐ ๐ฆ โ ๐ โ 0.5, ๐ + 0.5
78
๐ = โ1 ๐ = 0 ๐ = 1 โ1 1 ๐ ๐ฝโ1 ๐ฝ0 ๐ฝ1
๐ฆ โ ๐ โถ ๐ ๐ฆ โ ๐ โ 0.5, ๐ + 0.5
79
๐ = โ1 ๐ = 0 ๐ = 1 โ1 1 ๐ ๐ฝโ1 ๐ฝ0 ๐ฝ1
๐ฆ โ ๐ โถ ๐ ๐ฆ โ ๐ โ 0.5, ๐ + 0.5
80
๐ = โ1 ๐ = 0 ๐ = 1 โ1 1 ๐ ๐ฝโ1 ๐ฝ0 ๐ฝ1
๐ฆ โ ๐ โถ ๐ ๐ฆ โ ๐ โ 0.5, ๐ + 0.5
๐(๐ฆ) = ๐ฆ ร C 1 + ๐ : ๐ < ๐ ๐ฆ รf C
81
๐ = โ1 ๐ = 0 ๐ = 1 โ1 1 ๐ ๐ฝโ1 ๐ฝ0 ๐ฝ1
๐ฆ โ ๐ โถ ๐ ๐ฆ โ ๐ โ 0.5, ๐ + 0.5
๐(๐ฆ) = ๐ฆ ร C 1 + ๐ : ๐ < ๐ ๐ฆ รf C ๐ โ 0.5 ๐ + 0.5
82
๐ = โ1 ๐ = 0 ๐ = 1 โ1 1 ๐ ๐ฝโ1 ๐ฝ0 ๐ฝ1
๐ฆ โ ๐ โถ ๐ ๐ฆ โ ๐ โ 0.5, ๐ + 0.5
๐(๐ฆ) = ๐ฆ ร C 1 + ๐ : ๐ < ๐ ๐ฆ รf C ๐ โ 0.5 ๐ + 0.5
83
๐ = โ1 ๐ = 0 ๐ = 1 โ1 1 ๐ ๐ฝโ1 ๐ฝ0 ๐ฝ1
๐ = ๐
๐ฆ โ ๐ โถ ๐ ๐ฆ โ ๐ โ 0.5, ๐ + 0.5
๐(๐ฆ) = ๐ฆ ร C 1 + ๐ : ๐ < ๐ ๐ฆ รf C ๐ โ 0.5 ๐ + 0.5
84
๐ = โ1 ๐ = 0 ๐ = 1 โ1 1 ๐ ๐ฝโ1 ๐ฝ0 ๐ฝ1
๐ = ๐
๐ฆ โ ๐ โถ ๐ ๐ฆ โ ๐ โ 0.5, ๐ + 0.5
๐(๐ฆ) = ๐ฆ ร C 1 + ๐ : ๐ < ๐ ๐ฆ รf C ๐ โ 0.5 ๐ + 0.5
85
๐ = โ1 ๐ = 0 ๐ = 1 โ1 1 ๐ ๐ฝโ1 ๐ฝ0 ๐ฝ1
๐ = ๐
be a symbolic abstraction on ๐ฝ๐
max
๐ฆโ๐ฝ๐, |๐๐|<๐ ๐๐ฆโ๐ต๐ ๐ฆ ๐๐ฆ
86
be a symbolic abstraction on ๐ฝ๐
max
๐ฆโ๐ฝ๐, |๐๐|<๐ ๐๐ฆโ๐ต๐ ๐ฆ ๐๐ฆ
87
The constructed intervals do not cover ๐ in general
โ1 1
input range ๐
๐ฝโ1 ๐ฝ0 ๐ฝ1
88
The constructed intervals do not cover ๐ in general
โ1 1
input range ๐
๐ฝโ1 ๐ฝ0 ๐ฝ1
89
floating-point numbers
The constructed intervals do not cover ๐ in general
โ1 1
input range ๐
๐ฝโ1 ๐ฝ0 ๐ฝ1
90
floating-point numbers between intervals
The constructed intervals do not cover ๐ in general
โ1 1
input range ๐
๐ฝโ1 ๐ฝ0 ๐ฝ1
91
floating-point numbers between intervals
๐ = round ๐ฆ รf ๐ท
For ๐ฆ =
1 2๐ท ,
๐ would be 0 or 1
0.5 1
92
: abstraction of ๐ฆ รf ๐ท
๐ = round ๐ฆ รf ๐ท
For ๐ฆ =
1 2๐ท ,
๐ would be 0 or 1
0.5 1
93
: abstraction of ๐ฆ รf ๐ท
๐ฆ = 1/(3๐ท) ๐ฆ = 1/(1.5๐ท)
๐ = round ๐ฆ รf ๐ท
For ๐ฆ =
1 2๐ท ,
๐ would be 0 or 1
0.5 1
94
: abstraction of ๐ฆ รf ๐ท
๐ฆ = 1/(3๐ท) ๐ฆ = 1/(1.5๐ท)
๐ = 0 ๐ = 1
๐ = round ๐ฆ รf ๐ท
For ๐ฆ =
1 2๐ท ,
๐ would be 0 or 1
0.5 1
95
: abstraction of ๐ฆ รf ๐ท
๐ฆ = 1/(3๐ท) ๐ฆ = 1/(1.5๐ท) ๐ฆ = 1/(2๐ท)
๐ = 0 ๐ = 1
๐ = round ๐ฆ รf ๐ท
For ๐ฆ =
1 2๐ท ,
๐ would be 0 or 1
๐ฆ รf ๐ท 0.5 1
96
: abstraction of ๐ฆ รf ๐ท
๐ฆ = 1/(3๐ท) ๐ฆ = 1/(1.5๐ท) ๐ฆ = 1/(2๐ท)
๐ = 0 ๐ = 1
๐ = round ๐ฆ รf ๐ท
For ๐ฆ =
1 2๐ท ,
๐ would be 0 or 1
๐ฆ รf ๐ท 0.5 1
97
: abstraction of ๐ฆ รf ๐ท
๐ฆ = 1/(3๐ท) ๐ฆ = 1/(1.5๐ท) ๐ฆ = 1/(2๐ท)
๐ = 0 ๐ = 1
๐ = round ๐ฆ รf ๐ท
For ๐ฆ =
1 2๐ท ,
๐ would be 0 or 1
๐ฆ รf ๐ท 0.5 1
98
: abstraction of ๐ฆ รf ๐ท
๐ฆ = 1/(3๐ท) ๐ฆ = 1/(1.5๐ท) ๐ฆ = 1/(2๐ท)
๐ = 0 ๐ = 1
be a symbolic abstraction on ๐ฝ๐
max
๐ฆโ๐ฝ๐, |๐๐|<๐ ๐๐ฆโ๐ต๐ ๐ฆ ๐๐ฆ
max
๐ฆโ๐ผ ๐๐ฆโ๐ ๐ฆ ๐๐ฆ
99
be a symbolic abstraction on ๐ฝ๐
max
๐ฆโ๐ฝ๐, |๐๐|<๐ ๐๐ฆโ๐ต๐ ๐ฆ ๐๐ฆ
max
๐ฆโ๐ผ ๐๐ฆโ๐ ๐ฆ ๐๐ฆ
100
101
from S3D (a combustion simulation engine)
log: from
<math.h>
RelErr(๐, ๐) =
๐โ๐ ๐
102
from S3D (a combustion simulation engine)
log: from
<math.h>
RelErr(๐, ๐) =
๐โ๐ ๐
103
5 ULPs
๐ ๐
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
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
x-axis: input value y-axis: ULP error
bounds on the intervals
sin log
106 1014
โฎ
x-axis: input value y-axis: ULP error
bounds on the intervals
sin log
107 1014
โฎ
0x5fe6eb50c7b537a9 โ (x >> 1)
1014 ULPs for log on
4095 4096 , 1
property provides an imprecise abstraction
error analysis beyond 1 + ๐ property
6 ULPs for for log on 0,4
108
0x5fe6eb50c7b537a9 โ (x >> 1)
1014 ULPs for log on
4095 4096 , 1
property provides an imprecise abstraction
error analysis beyond 1 + ๐ property
6 ULPs for for log on 0,4
109
that mix floating-point and bit-level operations
analytical optimization, and testing
110
111