Changeset 416 for soft/giet_vm
- Timestamp:
- Sep 29, 2014, 12:07:05 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/sort/sort.py
r407 r416 17 17 # - x_width : number of bits coding x coordinate 18 18 # - y_width : number of bits coding y coordinate 19 # - procs_max: number of processors per cluster19 # - nprocs : number of processors per cluster 20 20 #################################################################################### 21 21 … … 25 25 x_size = mapping.x_size 26 26 y_size = mapping.y_size 27 procs_max = mapping.procs_max27 nprocs = mapping.nprocs 28 28 x_width = mapping.x_width 29 29 y_width = mapping.y_width 30 30 31 ntasks = x_size * y_size * procs_max31 ntasks = x_size * y_size * nprocs 32 32 33 33 # define vsegs base & size 34 34 code_base = 0x10000000 35 code_size = 0x00010000 # 64 Kbytes 35 code_size = 0x00010000 # 64 Kbytes (replicated in each cluster) 36 36 37 37 data_base = 0x20000000 38 data_size = 0x00010000 # 64 Kbytes 38 data_size = 0x00010000 # 64 Kbytes (non replicated) 39 39 40 ptab_base = 0x3000000041 ptab_size = 0x00040000 # 256 Kbytes40 args_base = 0x20010000 41 args_size = 0x00000004 # 4 bytes (non replicated) 42 42 43 43 stack_base = 0x40000000 44 stack_size = 0x00 010000 # 64 Kbytes44 stack_size = 0x00200000 # 2 Mbytes (per cluster) 45 45 46 heap_base = 0x50000000 47 heap_size = 0x00010000 # 64 Kbytes 48 49 args_base = 0x60000000 50 args_size = 0x00000004 # 4 bytes 46 heap_base = 0x60000000 47 heap_size = 0x00200000 # 2 Mbytes (per cluster) 51 48 52 49 # create Vspace 53 50 vspace = mapping.addVspace( name = 'sort', startname = 'sort_data' ) 54 51 55 # non replicated vsegs in cluster[0,0] 56 mapping.addVseg( vspace, 'sort_code', code_base , code_size, 'CXWU', vtype = 'ELF', 57 x = 0, y = 0, pseg = 'RAM', binpath = 'build/sort/sort.elf' ) 52 # data vseg : non local (only in cluster[0,0]) 53 mapping.addVseg( vspace, 'sort_data', data_base , data_size, 54 'C_WU', vtype = 'ELF', x = 0, y = 0, pseg = 'RAM', 55 binpath = 'build/sort/sort.elf', 56 local = False ) 58 57 59 mapping.addVseg( vspace, 'sort_data', data_base , data_size, 'C_WU', vtype = 'ELF', 60 x = 0, y = 0, pseg = 'RAM', binpath = 'build/sort/sort.elf' ) 58 # args vseg : non local (only in cluster[0,0]) 59 mapping.addVseg( vspace, 'sort_args', args_base , args_size, 60 'C_WU', vtype = 'CONST', x = 0, y = 0, pseg = 'RAM', 61 init = ntasks, 62 local = False ) 61 63 62 mapping.addVseg( vspace, 'sort_args', args_base , args_size, 'C_WU', vtype = 'CONST', 63 x = 0, y = 0, pseg = 'RAM', init = ntasks ) 64 # code vsegs : local (one copy per cluster) 65 for x in xrange (x_size): 66 for y in xrange (y_size): 67 mapping.addVseg( vspace, 'sort_code', code_base , code_size, 68 'CXWU', vtype = 'ELF', x = 0, y = 0, pseg = 'RAM', 69 binpath = 'build/sort/sort.elf', 70 local = True ) 64 71 65 # distributed vsegs: one stack per task, one ptab and heap per cluster 66 for c in mapping.clusters: 67 x, y = c.x, c.y 68 cluster_offset = ((x << y_width) + y) << 20 # 1 Mbytes per cluster 69 mapping.addVseg( vspace, 'sort_heap_%d_%d' % (x, y), 70 heap_base + cluster_offset, heap_size, 'C_WU', 71 vtype = 'BUFFER', x = x, y = y, pseg = 'RAM' ) 72 # stacks vsegs : local (one stack per task) 73 for x in xrange (x_size): 74 for y in xrange (y_size): 75 for p in xrange (nprocs) 76 proc_id = (((x * y_size) + y) * nprocs) + p 77 size = stack_size / nprocs 78 base = stack_base + (proc_id * size) 79 mapping.addVseg( vspace, 'sort_stack_%d_%d_%d' % (x,y,p), base, size 80 'C_WU', vtype = 'BUFFER', x = x, y = y, pseg = 'RAM', 81 local = True, big = True ) 72 82 73 mapping.addVseg( vspace, 'sort_ptab_%d_%d' % (x, y), 74 ptab_base + cluster_offset, ptab_size, 'C_WU', 75 vtype = 'PTAB', x = x, y = y, pseg = 'RAM', align = 13 ) 76 77 for p in c.procs: 78 l = p.lpid 79 proc_offset = cluster_offset + (l << 18) # 256 Kbytes per proc 80 mapping.addVseg( vspace, 'sort_stack_%d_%d_%d' % (x, y, l), 81 stack_base + proc_offset, stack_size, 'C_WU', 82 vtype = 'BUFFER', x = x, y = y, pseg = 'RAM' ) 83 # heap vsegs : distributed but non local (all tasks can access all heap vsegs) 84 for x in xrange (x_size): 85 for y in xrange (y_size): 86 cluster_id = (x * y_size) + y 87 size = heap_size 88 base = heap_base + (cluster_id * size) 89 mapping.addVseg( vspace, 'sort_heap_%d_%d' % (x,y), base, size, 90 'C_WU', vtype = 'BUFFER', x = x, y = y, pseg = 'RAM', 91 local = False, big = True ) 83 92 84 93 # distributed tasks / one task per processor 85 trdid = 0 86 for c in mapping.clusters: 87 x, y = c.x, c.y 88 for p in c.procs: 89 l = p.lpid 90 mapping.addTask( vspace, 'sort_%d_%d_%d' % (x, y, l), trdid, x, y, l, 91 'sort_stack_%d_%d_%d' % (x, y, l), 92 'sort_heap_%d_%d' % (x, y), 0 ) 93 trdid += 1 94 for x in xrange (x_size): 95 for y in xrange (y_size): 96 for p in xrange( nprocs ): 97 trdid = (((x * y_size) + y) * nprocs) + p 98 mapping.addTask( vspace, 'sort_%d_%d_%d' % (x,y,p), trdid, x, y, p, 99 'trsp_stack_%d_%d_%d' % (x,y,p), 100 'trsp_heap_%d_%d' % (x,y), 0 ) 94 101 95 102 # extend mapping name
Note: See TracChangeset
for help on using the changeset viewer.