Changeset 407 for soft


Ignore:
Timestamp:
Sep 12, 2014, 4:34:19 PM (10 years ago)
Author:
cfuguet
Message:

sort: introducing distributed ptabs in sort.py description file

File:
1 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/sort/sort.py

    r335 r407  
    1010#  This file describes the mapping of the multi-threaded "sort"
    1111#  application on a multi_clusters, multi-processors architecture.
    12 #  This include both the mapping of virtual segments on the clusters, 
     12#  This include both the mapping of virtual segments on the clusters,
    1313#  and the mapping of tasks on processors.
    1414#  This mapping uses 5 platform parameters, (obtained from the "mapping" argument)
     
    3434    code_base  = 0x10000000
    3535    code_size  = 0x00010000     # 64 Kbytes
    36    
     36
    3737    data_base  = 0x20000000
    3838    data_size  = 0x00010000     # 64 Kbytes
     
    4141    ptab_size  = 0x00040000     # 256 Kbytes
    4242
    43     stack_base = 0x40000000 
     43    stack_base = 0x40000000
    4444    stack_size = 0x00010000     # 64 Kbytes
    4545
    46     heap_base  = 0x50000000 
     46    heap_base  = 0x50000000
    4747    heap_size  = 0x00010000     # 64 Kbytes
    4848
    49     args_base  = 0x60000000 
     49    args_base  = 0x60000000
    5050    args_size  = 0x00000004     # 4 bytes
    5151
    5252    # create Vspace
    5353    vspace = mapping.addVspace( name = 'sort', startname = 'sort_data' )
    54    
     54
    5555    # non replicated vsegs in cluster[0,0]
    56     mapping.addVseg( vspace, 'sort_code', code_base , code_size, 'CXWU', vtype = 'ELF', 
     56    mapping.addVseg( vspace, 'sort_code', code_base , code_size, 'CXWU', vtype = 'ELF',
    5757                     x = 0, y = 0, pseg = 'RAM', binpath = 'build/sort/sort.elf' )
    5858
     
    6060                     x = 0, y = 0, pseg = 'RAM', binpath = 'build/sort/sort.elf' )
    6161
    62     mapping.addVseg( vspace, 'sort_ptab', ptab_base , ptab_size, 'C_WU', vtype = 'PTAB',
    63                      x = 0, y = 0, pseg = 'RAM', align = 13 )
    64 
    6562    mapping.addVseg( vspace, 'sort_args', args_base , args_size, 'C_WU', vtype = 'CONST',
    6663                     x = 0, y = 0, pseg = 'RAM', init = ntasks )
    6764
    68     # distributed vsegs: one stack per processor/task, one heap per cluster
    69     for x_rep in xrange (x_size):
    70         for y_rep in xrange (y_size):
    71             cluster_offset = ((x_rep << y_width) + y_rep) << 20  # 1 Mbytes per cluster
    72             mapping.addVseg( vspace, 'sort_heap_%d_%d' % (x_rep, y_rep),
    73                              heap_base + cluster_offset, heap_size, 'C_WU',
    74                              vtype = 'BUFFER', x = x_rep, y = y_rep, pseg = 'RAM' )
    75            
    76             for p in xrange( procs_max ):
    77                 proc_offset = cluster_offset + (p << 18)         # 256 Kbytes per proc
    78                 mapping.addVseg( vspace, 'sort_stack_%d_%d_%d' % (x_rep, y_rep, p),
    79                                  stack_base + proc_offset, stack_size, 'C_WU',
    80                                  vtype = 'BUFFER', x = x_rep, y = y_rep, pseg = 'RAM' )
    81            
     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
     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
    8284    # distributed tasks / one task per processor
    83     for x in xrange (x_size):
    84         for y in xrange (y_size):
    85             for p in xrange( procs_max ):
    86 
    87                 trdid = (((x * y_size) + y) * procs_max) + p
    88                 mapping.addTask( vspace, 'sort_%d_%d_%d' % (x,y,p), trdid, x, y, p,
    89                                  'sort_stack_%d_%d_%d' % (x,y,p),
    90                                  'sort_heap_%d_%d' % (x,y), 0 )
     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
    9194
    9295    # extend mapping name
     
    9598    return vspace  # useful for test
    9699
    97 ################################ test ######################################################
     100################################ test ###################################################
    98101
    99102if __name__ == '__main__':
    100    
     103
    101104    vspace = sort( Mapping( 'test', 2, 2, 4 ) )
    102105    print vspace.xml()
Note: See TracChangeset for help on using the changeset viewer.