Skip to content

Commit 57ca115

Browse files
authored
Merge pull request #116 from herbie-fp/rival-analyze-with-hints
Adding a separate function of `rival-analyze-with-hints`
2 parents 4274cfb + 236c9fc commit 57ca115

File tree

4 files changed

+10
-5
lines changed

4 files changed

+10
-5
lines changed

eval/main.rkt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
rival-compile
1515
rival-apply
1616
rival-analyze
17+
rival-analyze-with-hints
1718
(struct-out exn:rival)
1819
(struct-out exn:rival:invalid)
1920
(struct-out exn:rival:unsamplable)
@@ -82,7 +83,7 @@
8283
[else (loop (+ 1 iter))])))
8384

8485
; Assumes that hint (if provided) is correct for the given rect
85-
(define (rival-analyze machine rect [hint #f])
86+
(define (rival-analyze-with-hints machine rect [hint #f])
8687
; Load arguments
8788
(rival-machine-load machine rect)
8889
(define-values (good? done? bad? stuck? fvec)
@@ -91,3 +92,6 @@
9192
(define-values (hint* hint*-converged?)
9293
(make-hint machine (or hint (rival-machine-default-hint machine))))
9394
(list (ival (or bad? stuck?) (not good?)) hint* hint*-converged?))
95+
96+
(define (rival-analyze machine rect)
97+
(car (rival-analyze-with-hints machine rect)))

eval/tests.rkt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,11 @@
9797
(define no-hint-cnt 0)
9898
(for ([n (in-range number-of-random-hyperrects)])
9999
(define hyperrect (sample-hyperrect-within-bounds rect-lo rect-hi varc))
100-
(match-define (list res hint converged?) (rival-analyze machine hyperrect))
100+
(match-define (list res hint converged?) (rival-analyze-with-hints machine hyperrect))
101101

102102
; A little hack, the analyze below uses hint from the previous run
103103
; The analyze results must be equal. If not, something wrong has happened
104-
(match-define (list res* hint* converged?*) (rival-analyze machine hyperrect hint))
104+
(match-define (list res* hint* converged?*) (rival-analyze-with-hints machine hyperrect hint))
105105

106106
(with-check-info (['hyperrect hyperrect] ['hint hint])
107107
(check-equal? hint hint*)

info.rkt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#lang info
22

33
(define collection "rival")
4-
(define version "2.0")
4+
(define version "2.2")
55
(define license 'MIT)
66

77
;; Packaging information

main.rkt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,9 @@
9797
(->* (rival-machine? (vectorof value?))
9898
((or/c (vectorof any/c) boolean?))
9999
(vectorof any/c))]
100-
[rival-analyze
100+
[rival-analyze-with-hints
101101
(->* (rival-machine? (vectorof ival?)) ((or/c (vectorof any/c) boolean?)) (listof any/c))]
102+
[rival-analyze (-> rival-machine? (vectorof ival?) ival?)]
102103
[rival-profile (-> rival-machine? symbol? any/c)]
103104
[baseline-compile
104105
(-> (listof any/c) (listof symbol?) (listof discretization?) baseline-machine?)]

0 commit comments

Comments
 (0)