Skip to content

Commit 86dad8e

Browse files
committed
hmm, maybe the sound way to do lower bound
1 parent de44c4c commit 86dad8e

File tree

3 files changed

+14
-9
lines changed

3 files changed

+14
-9
lines changed

eval/adjust.rkt

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
; min-prec = (cdr (get-bounds parent))
8181
(define (precision-tuning ivec vregs vprecs-max varc vstart-precs)
8282
; vector stores minimum additional precision that is needed to evaluate an instruction
83-
(define vprecs-min (make-vector (vector-length vprecs-max) 0))
83+
; (define vprecs-min (make-vector (vector-length vprecs-max) 0))
8484
(for ([instr (in-vector ivec (- (vector-length ivec) 1) -1 -1)] ; reversed over ivec
8585
[n (in-range (- (vector-length vregs) 1) -1 -1)]) ; reversed over indices of vregs
8686
(define op (car instr)) ; current operation
@@ -89,10 +89,10 @@
8989
(define output (vector-ref vregs n)) ; output of the current instr
9090

9191
(define max-prec (vector-ref vprecs-max (- n varc))) ; upper precision bound given from parent
92-
(define min-prec (vector-ref vprecs-min (- n varc))) ; lower precision bound given from parent
92+
; (define min-prec (vector-ref vprecs-min (- n varc))) ; lower precision bound given from parent
9393

94-
(when (>= min-prec (*rival-max-precision*)) ; Early stopping on lower bound
95-
(*sampling-iteration* (*rival-max-iterations*)))
94+
#;(when (>= min-prec (*rival-max-precision*)) ; Early stopping on lower bound
95+
(*sampling-iteration* (*rival-max-iterations*)))
9696

9797
; Final precision assignment based on the upper bound
9898
(define final-precision
@@ -112,7 +112,9 @@
112112
(- x varc)
113113
(max (vector-ref vprecs-max (- x varc)) (+ max-prec up-bound)))
114114

115+
(when (>= lo-bound (*rival-max-precision*)) ; Early stopping on lower bound
116+
(*sampling-iteration* (*rival-max-iterations*)))
115117
; Lower precision bound propogation
116-
(vector-set! vprecs-min
117-
(- x varc)
118-
(max (vector-ref vprecs-min (- x varc)) (+ min-prec lo-bound))))))
118+
#;(vector-set! vprecs-min
119+
(- x varc)
120+
(max (vector-ref vprecs-min (- x varc)) (+ min-prec lo-bound))))))

eval/compile.rkt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
(provide rival-compile
99
*rival-use-shorthands*
1010
*rival-name-constants*
11-
fn->ival-fn
11+
fn->ival-fn ; for baseline
1212
exprs->batch) ; for baseline
1313

1414
(define *rival-use-shorthands* (make-parameter #t))

eval/tricks.rkt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,10 @@
161161
[(ival-sin)
162162
; maxlog(x) - minlog(z)
163163
(define x (first srcs))
164-
(list (cons (- (maxlog x) (minlog z)) (- (maxlog z #:no-slack #t))))]
164+
(list (cons (- (maxlog x) (minlog z))
165+
(if (> (minlog x) 1)
166+
(- (maxlog z #:no-slack #t))
167+
0)))]
165168

166169
[(ival-cos)
167170
; maxlog(x) - minlog(z) + min(maxlog(x), 0)

0 commit comments

Comments
 (0)