Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Diff of /branches/charisee/src/compiler/high-to-mid/expand-integrate.sml
ViewVC logotype

Diff of /branches/charisee/src/compiler/high-to-mid/expand-integrate.sml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2501, Mon Nov 4 17:23:39 2013 UTC revision 2502, Mon Nov 4 21:33:35 2013 UTC
# Line 11  Line 11 
11      local      local
12    
13      structure E = Ein      structure E = Ein
14        structure DstIL = MidIL
15        structure DstTy = MidILTypes
16    
17      in      structure DstOp = MidOps
18        structure DstV = DstIL.Var
19        structure mk= mkOperators
20    
 (*  
 Dictionary created for Tensor positions  
 Tensor X=> fractional and integer tensors in mid-il operators  
 Save in variable names.  
21    
22  *)      in
23    
24    
25    fun assign (x, rator, args) = (x, DstIL.OP(rator, args))
26    fun assignEin (x, rator, args) = (x, DstIL.EINAPP(rator, args))
27  fun insert (key, value) d =fn s =>  fun insert (key, value) d =fn s =>
28          if s = key then SOME value          if s = key then SOME value
29          else d s          else d s
   
30  fun lookup k d = d k  fun lookup k d = d k
31    
32    
33    (*Create fractional, and integer position vectors*)
34    fun createArgs(dim,v,pos,s)=let
35        val translate=DstOp.Translate v
36        val transform=DstOp.Transform v
37    
38        (* Match EinTypes, or mid-il types?
39        val vecsTy =mk.createVec(2*s)
40        val vecDimTy = mk.createVec(dim)
41        *)
42    
43    
44        val M = DstV.new ("M", DstTy.tensorTy [dim,dim]) (*transform dim by dim?*)
45        val T = DstV.new ("T", DstTy.vecTy dim)          (*translate*)
46        val x = DstV.new ("x", DstTy.vecTy dim)
47        val f = DstV.new ("f", DstTy.vecTy dim)         (*fractional*)
48        val nd = DstV.new ("nd", DstTy.vecTy dim)       (*real position*)
49        val n = DstV.new ("n", DstTy.iVecTy dim)        (*interger position*)
50    
51    
52        val PosToImgSpace=mk.transform(dim,dim)
53        val code=[
54                assign(M, transform, []),
55                assign(T, translate, []),
56                assignEin(x, PosToImgSpace,[M,pos,T]) ,  (* MX+T*)
57                assign(nd, DstOp.Floor dim, [x]),   (*nd *)
58                assignEin(f, mk.subTen([dim]),[x,nd]),           (*fractional*)
59                assign(n, DstOp.RealToInt dim, [nd]) (*real to Int*)
60    
61                ]
62    
63          (*Then f, n are new positions created. add to args list of currrent EinExp*)
64        val args=[f,n]
65        in (args,code)
66        end
67  (*  (*
68    
69    

Legend:
Removed from v.2501  
changed lines
  Added in v.2502

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0