File tree Expand file tree Collapse file tree 2 files changed +10
-11
lines changed Expand file tree Collapse file tree 2 files changed +10
-11
lines changed Original file line number Diff line number Diff line change 244244 ; Update table
245245 (hash-set! impls (operator-impl-name impl) impl))
246246
247+ (define (validate-platform! platform)
248+ (when (empty? (platform-implementations platform))
249+ (raise-herbie-error "Platform contains no operations " ))
250+ (for ([(name impl) (in-hash (platform-implementations platform))])
251+ (define ctx (operator-impl-ctx impl))
252+ (for ([repr (in-list (cons (context-repr ctx) (context-var-reprs ctx)))])
253+ (unless (equal? (hash-ref (platform-representations platform) (representation-name repr) #f )
254+ repr)
255+ (raise-herbie-error "Representation ~a not defined " (representation-name repr))))))
256+
247257(define-syntax (platform-register-implementations! stx)
248258 (syntax-case stx ()
249259 [(_ platform ([name ([var : repr] ... ) otype spec fl fpcore cost] ... ))
Original file line number Diff line number Diff line change 3232 platform-lifting-rules
3333 platform-lowering-rules
3434 platform-copy
35- validate-platform!
3635 repr-exists?
3736 get-representation
3837 impl-exists?
6867 (define impls (make-hash))
6968 (create-platform reprs impls repr-costs))
7069
71- (define (validate-platform! platform)
72- (when (empty? (platform-implementations platform))
73- (raise-herbie-error "Platform contains no operations " ))
74- (for ([(name impl) (in-hash (platform-implementations platform))])
75- (define ctx (operator-impl-ctx impl))
76- (for ([repr (in-list (cons (context-repr ctx) (context-var-reprs ctx)))])
77- (unless (equal? (hash-ref (platform-representations platform) (representation-name repr) #f )
78- repr)
79- (raise-herbie-error "Representation ~a not defined " (representation-name repr))))))
80-
8170;; Returns the representation associated with `name`
8271;; attempts to generate the repr if not initially found
8372(define (get-representation name)
You can’t perform that action at this time.
0 commit comments