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

SCM Repository

[diderot] Diff of /branches/cuda/src/compiler/target-cuda/gen.sml
ViewVC logotype

Diff of /branches/cuda/src/compiler/target-cuda/gen.sml

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

revision 5599, Mon Jun 21 23:31:32 2021 UTC revision 5600, Tue Jun 29 22:09:41 2021 UTC
# Line 45  Line 45 
45              val var = CL.mkSelect(g_var, name);              val var = CL.mkSelect(g_var, name);
46              val target_var_name = CL.mkSelect(gpu_g_var, name);              val target_var_name = CL.mkSelect(gpu_g_var, name);
47              val imgCxxTy = TrCxx.trType(Env.empty spec, imgty)              val imgCxxTy = TrCxx.trType(Env.empty spec, imgty)
48                val _ = print name
49                val _  = ": img"
50          in          in
51              CL.mkAssign(target_var_name, (CL.mkNew(imgCxxTy, [var])))              CL.mkAssign(target_var_name, (CL.mkNew(imgCxxTy, [var])))
52          end          end
53    
54        fun copy_other tt name gvg_var gpu_g_var spec  =
55            let
56                val _ = print name
57                val _ = print ": "
58                val _ = print (TreeTypes.toString tt)
59                val _ = print "\n"
60            in
61                CL.skip
62            end
63    
64    
65      fun copy_field_match (TrTy.TensorRefTy lengths) name gvg_var gpu_g_var spec = raise Fail "not Implemented: tensorref"      fun copy_field_match (TrTy.TensorRefTy lengths) name gvg_var gpu_g_var spec = raise Fail "not Implemented: tensorref"
66          | copy_field_match (TrTy.ImageTy info) name gvg_var gpu_g_var spec = copy_image name gvg_var gpu_g_var (TrTy.ImageTy info) spec          | copy_field_match (TrTy.ImageTy info) name gvg_var gpu_g_var spec = copy_image name gvg_var gpu_g_var (TrTy.ImageTy info) spec
67          | copy_field_match (TrTy.TupleTy ttypes) name gvg_var gpu_g_var spec = raise Fail "not Implemented: tuple"          | copy_field_match (TrTy.TupleTy ttypes) name gvg_var gpu_g_var spec = raise Fail "not Implemented: tuple"
68          | copy_field_match (TrTy.SeqTy (stype_i,len_opt)) name gvg_var gpu_g_var spec = raise Fail "not Implemented: list"          | copy_field_match (TrTy.SeqTy (stype_i,len_opt)) name gvg_var gpu_g_var spec = raise Fail "not Implemented: list"
69          | copy_field_match tt name gvg_var gpu_g_var spec = CL.skip          | copy_field_match tt name gvg_var gpu_g_var spec = copy_other tt name gvg_var gpu_g_var spec
70    
71      fun copy_field (IR.GV{ty, name, ...}) gvg_var gpu_g_var =  copy_field_match ty name gvg_var gpu_g_var      fun copy_field (IR.GV{ty, name, ...}) gvg_var gpu_g_var =  copy_field_match ty name gvg_var gpu_g_var
72    
# Line 71  Line 84 
84          val prep_copy_param = CL.PARAM ([],CL.T_Ptr (CL.T_Named "globals"), "gpu_prep_globals")          val prep_copy_param = CL.PARAM ([],CL.T_Ptr (CL.T_Named "globals"), "gpu_prep_globals")
85          val gpu_var = CL.mkVar "gpu_globals";          val gpu_var = CL.mkVar "gpu_globals";
86          val gpu_param = CL.PARAM ([],CL.T_Ptr (CL.T_Ptr (CL.T_Named "globals")), "gpu_globals");          val gpu_param = CL.PARAM ([],CL.T_Ptr (CL.T_Ptr (CL.T_Named "globals")), "gpu_globals");
87          val deallocate_prep_copy = CL.mkDelete (*CL.mkUnOp (CL.%*, prep_copy_var)*) prep_copy_var;          val deallocate_prep_copy = CL.mkDelete (CL.mkUnOp (CL.%*, prep_copy_var));
88          val field_copy_stmt = copy_fields globals prep_copy_var (*CL.mkUnOp (CL.%*, gpu_var)*) gpu_var spec;          val field_copy_stmt = copy_fields globals prep_copy_var (CL.mkUnOp (CL.%*, gpu_var)) spec;
89          val block = CL.mkBlock field_copy_stmt;          val block = CL.mkBlock (field_copy_stmt @ [deallocate_prep_copy]);
90      in      in
91         CL.mkFuncDcl(CL.voidTy, "copy_globals", [prep_copy_param, gpu_param], block)         CL.mkFuncDcl(CL.voidTy, "copy_globals", [prep_copy_param, gpu_param], block)
92      end      end
# Line 177  Line 190 
190              ("DIDEROT_REAL_SIZE",       if #double spec then "64" else "32"),              ("DIDEROT_REAL_SIZE",       if #double spec then "64" else "32"),
191              ("DIDEROT_INT_SIZE",        if #longint spec then "64" else "32"),              ("DIDEROT_INT_SIZE",        if #longint spec then "64" else "32"),
192              ("BOOLTY",                  SizeOf.c_bool),              ("BOOLTY",                  SizeOf.c_bool),
193                ("CUDA_INNER_BLK_SIZE",     "64"), (* TODO *)
194                ("CUDA_NO_BLOCKS",     "64"), (* TODO *)
195            (* START_{PARAMS,ARGS,ARGS_IN_WRLD} used for            (* START_{PARAMS,ARGS,ARGS_IN_WRLD} used for
196             *    worker_cache::run_start_methods (@START_PARAMS@ ...)             *    worker_cache::run_start_methods (@START_PARAMS@ ...)
197             *    worker_cache::strand_start (@START_PARAMS@ ...)             *    worker_cache::strand_start (@START_PARAMS@ ...)
# Line 282  Line 297 
297      fun runFrag (spec, subs) = let      fun runFrag (spec, subs) = let
298            val frags = (case (TSpec.noBSP spec)            val frags = (case (TSpec.noBSP spec)
299                   of (false) => [Frags.runCuda]                   of (false) => [Frags.runCuda]
300                    | (true) => raise Fail "unsupported"                    | (true) => [Frags.runCuda]
301                  (* end case *))                  (* end case *))
302            val frags = (case (#hasStartMeth spec)            val frags = (case (#hasStartMeth spec)
303                   of (true) => Frags.runStartMethods :: frags                   of (true) => Frags.runStartMethods :: frags
# Line 407  Line 422 
422          val outS = openCudaOut baseName          val outS = openCudaOut baseName
423          val env = mkEnv spec          val env = mkEnv spec
424          val substitutions = mkSubs (spec, strand, create)          val substitutions = mkSubs (spec, strand, create)
         val _ = print "abc\n";  
425          val gCpy = copy_globals globals spec          val gCpy = copy_globals globals spec
         val _ = print "def\n";  
426      (* output to C++ file *)      (* output to C++ file *)
427          val ppDecl = Out.decl outS          val ppDecl = Out.decl outS
428          val fragment = Out.fragment substitutions outS          val fragment = Out.fragment substitutions outS
429          val {preWorld, postWorld} = GenTysAndOps.gen (env, CollectInfo.collect prog)          val {preWorld, postWorld} = GenTysAndOps.gen (env, CollectInfo.collect prog)
430          val outputs = OutputUtil.gatherOutputs (spec, prog)          val outputs = OutputUtil.gatherOutputs (spec, prog)
431          in          in
         print "I am here\n";  
432          ppDecl (CL.verbatimDcl [CxxFragments.cxxHead] substitutions);          ppDecl (CL.verbatimDcl [CxxFragments.cxxHead] substitutions);
433          outputDefines (outS, spec, defs, substitutions);          outputDefines (outS, spec, defs, substitutions);
434          ppDecl (CL.verbatimDcl [CxxFragments.execIncl] substitutions);          ppDecl (CL.verbatimDcl [CxxFragments.execIncl] substitutions);
# Line 433  Line 445 
445          (* generate main function after closing off the namespace *)          (* generate main function after closing off the namespace *)
446          ppDecl (CL.verbatimDcl [Frags.exitWithError] substitutions);          ppDecl (CL.verbatimDcl [Frags.exitWithError] substitutions);
447          ppDecl (verbFrag (spec, Frags.main, Frags.main, substitutions));          ppDecl (verbFrag (spec, Frags.main, Frags.main, substitutions));
448     (*  FIXME   ppDecl gCpy; *)          ppDecl gCpy;
449          Out.closeOut outS;          Out.closeOut outS;
         raise Fail "compilation not implemented";  
450          compile (spec, baseName);          compile (spec, baseName);
451          RunCC.linkExec (baseName, ldFlags spec)          RunCC.linkExec (baseName, ldFlags spec)
452          end          end

Legend:
Removed from v.5599  
changed lines
  Added in v.5600

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