|
4 | 4 | "../ops/all.rkt" |
5 | 5 | "machine.rkt" |
6 | 6 | racket/list |
7 | | - racket/match) |
| 7 | + racket/match |
| 8 | + racket/vector |
| 9 | + racket/function) |
8 | 10 |
|
9 | 11 | (provide backward-pass |
10 | 12 | make-hint) |
|
235 | 237 | ; max-prec = (car (get-bounds parent)) |
236 | 238 | (define (precision-tuning ivec vregs vprecs-max varc vstart-precs vrepeats vhint) |
237 | 239 | (define vprecs-min (make-vector (vector-length ivec) 0)) |
| 240 | + |
| 241 | + (define slack (get-slack)) |
| 242 | + (define vlogs (vector-map (curryr minlog+maxlog+logspan slack) vregs)) |
| 243 | + |
238 | 244 | (for ([instr (in-vector ivec (- (vector-length ivec) 1) -1 -1)] |
239 | 245 | [repeat? (in-vector vrepeats (- (vector-length vrepeats) 1) -1 -1)] |
240 | 246 | [n (in-range (- (vector-length vregs) 1) -1 -1)] |
241 | 247 | [hint (in-vector vhint (- (vector-length vhint) 1) -1 -1)] |
242 | 248 | [output (in-vector vregs (- (vector-length vregs) 1) -1 -1)] |
| 249 | + [logs (in-vector vlogs (- (vector-length vlogs) 1) -1 -1)] |
243 | 250 | #:when (and hint (not repeat?))) |
244 | 251 | (define op (car instr)) |
245 | 252 | (define tail-registers (drop-self-pointer (cdr instr) n)) |
246 | | - (define srcs (map (lambda (x) (vector-ref vregs x)) tail-registers)) |
| 253 | + (define srcs (map (lambda (x) (cons (vector-ref vregs x) (vector-ref vlogs x))) tail-registers)) |
247 | 254 |
|
248 | 255 | (define max-prec (vector-ref vprecs-max (- n varc))) ; upper precision bound given from parent |
249 | 256 | (define min-prec (vector-ref vprecs-min (- n varc))) ; lower precision bound given from parent |
|
264 | 271 | (*sampling-iteration* (*rival-max-iterations*)))]) |
265 | 272 |
|
266 | 273 | ; Precision propogation for each tail instruction |
267 | | - (define ampl-bounds (get-bounds op output srcs)) ; amplification bounds for children instructions |
| 274 | + (define ampl-bounds |
| 275 | + (get-bounds op (cons output logs) srcs)) ; amplification bounds for children instructions |
268 | 276 | (for ([x (in-list tail-registers)] |
269 | 277 | [bound (in-list ampl-bounds)] |
270 | 278 | #:when (>= x varc)) ; when tail register is not a variable |
|
0 commit comments