|
48 | 48 | (define (read-from-string s) |
49 | 49 | (read (open-input-string s))) |
50 | 50 |
|
51 | | -(define (time-expr rec timeline) |
| 51 | +(define (time-expr rec timeline sollya-reeval) |
52 | 52 | (define exprs (map read-from-string (hash-ref rec 'exprs))) |
53 | 53 | (define vars (map read-from-string (hash-ref rec 'vars))) |
54 | 54 | (unless (andmap symbol? vars) |
|
79 | 79 |
|
80 | 80 | (define tuned-bench #f) |
81 | 81 | (define times |
82 | | - (for/list ([pt (in-list (hash-ref rec 'points))]) |
| 82 | + (for/list ([pt* (in-list (hash-ref rec 'points))]) |
| 83 | + (match-define (list pt sollya-exs sollya-status sollya-apply-time) pt*) |
83 | 84 | ; --------------------------- Baseline execution ---------------------------------------------- |
84 | 85 | (define baseline-start-apply (current-inexact-milliseconds)) |
85 | 86 | (match-define (list baseline-status baseline-exs) |
|
174 | 175 | ; We treat Rival's results as the right ones since for some benchs Sollya has produced wrong results! |
175 | 176 | (when (and (and rival-machine baseline-machine sollya-machine) |
176 | 177 | (or (equal? rival-status 'valid) (equal? rival-status 'unsamplable))) |
177 | | - |
178 | | - (define sollya-apply-time 0.0) |
179 | | - (match-define (list sollya-status sollya-exs) |
180 | | - (match sollya-machine |
181 | | - [#f (list #f #f)] ; if sollya machine is not working for this benchmark |
182 | | - [else |
183 | | - (with-handlers ([exn:fail? (λ (e) |
184 | | - (printf "Sollya failed") |
185 | | - (printf "~a\n" e) |
186 | | - (sollya-kill sollya-machine) |
187 | | - (set! sollya-machine #f) |
188 | | - (list #f #f))]) |
189 | | - (match-define (list internal-time external-time exs status) |
190 | | - (sollya-apply sollya-machine pt #:timeout (*sampling-timeout*))) |
191 | | - (set! sollya-apply-time external-time) |
192 | | - (list status exs))])) |
| 178 | + (match sollya-reeval |
| 179 | + [#t |
| 180 | + (set! sollya-apply-time 0.0) |
| 181 | + (match sollya-machine |
| 182 | + [#f (list #f #f)] ; if sollya machine is not working for this benchmark |
| 183 | + [else |
| 184 | + (with-handlers ([exn:fail? (λ (e) |
| 185 | + (printf "Sollya failed") |
| 186 | + (printf "~a\n" e) |
| 187 | + (sollya-kill sollya-machine) |
| 188 | + (set! sollya-machine #f) |
| 189 | + (list #f #f))]) |
| 190 | + (match-define (list internal-time external-time exs status) |
| 191 | + (sollya-apply sollya-machine pt #:timeout (*sampling-timeout*))) |
| 192 | + (set! sollya-apply-time external-time) |
| 193 | + (set! sollya-status status) |
| 194 | + (set! sollya-exs exs))])] |
| 195 | + [#f |
| 196 | + (set! sollya-exs |
| 197 | + (match sollya-exs |
| 198 | + ["#f" #f] |
| 199 | + [#f #f] |
| 200 | + [_ (fl (string->number sollya-exs))])) |
| 201 | + |
| 202 | + (set! sollya-status |
| 203 | + (match sollya-status |
| 204 | + ["#f" 'invalid] |
| 205 | + [#f 'invalid] |
| 206 | + [_ (string->symbol sollya-status)])) |
| 207 | + |
| 208 | + (set! sollya-apply-time |
| 209 | + (match sollya-apply-time |
| 210 | + ["#f" 0.0] |
| 211 | + [#f 0.0] |
| 212 | + [_ sollya-apply-time]))]) |
193 | 213 |
|
194 | 214 | ; -------------------------------- Combining results ---------------------------------------- |
195 | 215 | ; When all the machines have compiled and produced results - write the results to outcomes |
|
220 | 240 | (equal? baseline-status 'valid)) |
221 | 241 | 1 |
222 | 242 | 0)) |
223 | | - |
224 | 243 | (cons rival-status (cons rival-apply-time rival-baseline-difference)))) |
225 | 244 |
|
226 | 245 | ; Zombie process |
|
313 | 332 | (for/list ([(key value) (in-hash (hash-ref timeline 'density))]) |
314 | 333 | (list key value)))) |
315 | 334 |
|
316 | | -(define (make-expression-table points test-id timeline-port) |
| 335 | +(define (make-expression-table points test-id timeline-port sollya-reeval) |
317 | 336 | (newline) |
318 | 337 | (define total-c 0.0) |
319 | 338 | (define total-v 0.0) |
|
342 | 361 | (pretty-print (map read-from-string (hash-ref rec 'exprs)))) |
343 | 362 |
|
344 | 363 | (match-define (list c-time v-num v-time i-num i-time u-num u-time rival-baseline-diff) |
345 | | - (time-exprs (time-expr rec timeline))) |
| 364 | + (time-exprs (time-expr rec timeline sollya-reeval))) |
346 | 365 | (set! total-c (+ total-c c-time)) |
347 | 366 | (set! total-v (+ total-v v-time)) |
348 | 367 | (set! count-v (+ count-v v-num)) |
|
358 | 377 | (~r i-time #:precision '(= 3) #:min-width 8) |
359 | 378 | (~r u-time #:precision '(= 3) #:min-width 8)) |
360 | 379 | (list i t-time c-time v-num v-time i-num i-time u-num u-time rival-baseline-diff))) |
361 | | - |
362 | 380 | (printf "\nDATA:\n") |
363 | 381 | (printf "\tNUMBER OF TUNED BENCHMARKS = ~a\n" (*num-tuned-benchmarks*)) |
364 | 382 | (printf "\tRIVAL TIMEOUTS = ~a\n" (*rival-timeout*)) |
|
433 | 451 | (fprintf port "<section id='profile'><h1>Profiling</h1>") |
434 | 452 | (fprintf port "<p class='load-text'>Loading profile data...</p></section>"))) |
435 | 453 |
|
436 | | -(define (run test-id p timeline-port) |
| 454 | +(define (run test-id p timeline-port sollya-reeval) |
437 | 455 | (define operation-table |
438 | 456 | (and (or (not test-id) (not (string->number test-id))) (make-operation-table test-id))) |
439 | 457 | (define-values (expression-table expression-footer) |
440 | 458 | (if (and p (or (not test-id) (string->number test-id))) |
441 | | - (make-expression-table p test-id timeline-port) |
| 459 | + (make-expression-table p test-id timeline-port sollya-reeval) |
442 | 460 | (values #f #f))) |
443 | 461 | (list operation-table expression-table expression-footer)) |
444 | 462 |
|
|
500 | 518 | (define html-port #f) |
501 | 519 | (define timeline-port #f) |
502 | 520 | (define profile-port #f) |
| 521 | + (define sollya-reeval #f) |
503 | 522 | (define n #f) |
504 | 523 | (command-line |
505 | 524 | #:once-each |
|
517 | 536 | "Produce a JSON profile" |
518 | 537 | (set! profile-port (open-output-file fn #:mode 'text #:exists 'replace))] |
519 | 538 | [("--id") ns "Run a single test" (set! n ns)] |
| 539 | + [("--sollya-reeval") "Reevaluate Sollya" (set! sollya-reeval #t)] |
520 | 540 | #:args ([points "infra/points.json"]) |
521 | 541 | (match-define (list op-t ex-t ex-f) |
522 | 542 | (if profile-port |
523 | 543 | (profile #:order 'total |
524 | 544 | #:delay 0.001 |
525 | 545 | #:render (profile-json-renderer profile-port) |
526 | | - (run n (open-input-file points) timeline-port)) |
527 | | - (run n (open-input-file points) timeline-port))) |
| 546 | + (run n (open-input-file points) timeline-port sollya-reeval)) |
| 547 | + (run n (open-input-file points) timeline-port sollya-reeval))) |
528 | 548 | (when dir |
529 | 549 | (generate-html html-port profile-port op-t ex-t ex-f dir)))) |
530 | 550 |
|
|
0 commit comments