forked from marcoheisig/cl-isl
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathast-generation.lisp
More file actions
64 lines (54 loc) · 2.85 KB
/
ast-generation.lisp
File metadata and controls
64 lines (54 loc) · 2.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
(in-package :cl-isl)
(define-isl-function ast-build-node-from-schedule %isl-ast-build-node-from-schedule
(:give ast-node)
(:take ast-build)
(:take schedule))
(define-isl-function ast-build-node-from-schedule-map %isl-ast-build-node-from-schedule-map
(:give ast-node)
(:take ast-build)
(:take union-map))
(defun generate-debug-ast (domain read-access write-access initial-schedule)
(declare (ignore domain read-access write-access))
(let* ((ast-build (create-ast-build))
(ast-node (ast-build-node-from-schedule-map ast-build initial-schedule)))
ast-node))
(defun generate-optimized-ast (domain read-access write-access initial-schedule)
(let* ((before-map (union-map-lex-lt-union-map initial-schedule initial-schedule))
(read-access (union-map-intersect-domain read-access domain))
(write-access (union-map-intersect-domain write-access domain))
(RaW (union-map-intersect
(union-map-apply-range write-access (union-map-reverse read-access))
before-map))
(WaW (union-map-intersect
(union-map-apply-range write-access (union-map-reverse write-access))
before-map))
(WaR (union-map-intersect
(union-map-apply-range read-access (union-map-reverse write-access))
before-map))
#+(or)
(RaR (union-map-intersect
(union-map-apply-range read-access (union-map-reverse read-access))
before-map))
(total (union-map-union (union-map-union RaW WaW) WaR))
(sconstraint (schedule-constraints-on-domain domain))
(sconstraint (schedule-constraints-set-validity sconstraint total))
(sconstraint (schedule-constraints-set-coincidence sconstraint RaW))
;;(coincidence (union-map-from-str " { [i0, i1, i2, i3, i4 ] -> [i0, i1, i2, i3, i5] } "))
;;(sconstraint (schedule-constraints-set-coincidence sconstraint coincidence))
;; todo
;; Proximity
;; Read: domain -> read access
;; Read^1 : read access -> domain
;; What we want: map (Read^1 (memory location)) to (Read^1 (next memory location))
(memory->domain (union-map-reverse (union-map-union read-access write-access)))
(memory-proximity (union-map-from-str "{ [i0, i1] -> [i0, j] : i1+1 = j }"))
(memory-proximity (union-map-apply-range memory-proximity memory->domain))
(memory-proximity (union-map-apply-domain memory-proximity memory->domain))
(_ (print "memory-proximity"))
(_ (print memory-proximity))
(sconstraint (schedule-constraints-set-proximity sconstraint memory-proximity))
(schedule (schedule-constraints-compute-schedule sconstraint))
(ast-build (create-ast-build))
(node (ast-build-node-from-schedule ast-build schedule)))
(print node)
node))