Changeset 542


Ignore:
Timestamp:
Mar 30, 2015, 6:22:52 PM (9 years ago)
Author:
bellefin
Message:

Using the heap_init() function

File:
1 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/applications/classif/main.c

    r536 r542  
    3333// The MWMR fifo descriptors array is defined as a global variable in cluster[0][0].
    3434//
    35 // Initialisation is done in two steps by the "load" & "store" tasks:
    36 // - Task "load" in cluster[0][0] initialises the barrier between all "load" tasks,
    37 //   allocates NIC & CMA RX channel, and starts the NIC_CMA RX transfer.
     35// Initialisation is done in three steps by the "load" & "store" tasks:
     36// - Task "load" in cluster[0][0] initialises the heaps in all clusters. Other tasks
     37//   are waiting on the global_sync synchronisation variable.
     38// - Then task "load" in cluster[0][0] initialises the barrier between all "load"
     39//   tasks, allocates NIC & CMA RX channel, and starts the NIC_CMA RX transfer.
    3840//   Other "load" tasks are waiting on the load_sync synchronisation variable.
    3941//   Task "store" in cluster[0][0] initialises the barrier between all "store" tasks,
     
    9698
    9799// global synchro signaling global initialisation completion
    98 volatile unsigned int        load_sync  = 0;
    99 volatile unsigned int        store_sync = 0;
     100volatile unsigned int        global_sync = 0;
     101volatile unsigned int        load_sync   = 0;
     102volatile unsigned int        store_sync  = 0;
    100103
    101104// instrumentation counters
     
    117120{
    118121    // each "load" task get platform parameters
    119     unsigned int    x_size;                                             // number of clusters in a row
     122    unsigned int    x_size;                     // number of clusters in a row
    120123    unsigned int    y_size;                     // number of clusters in a column
    121124    unsigned int    nprocs;                     // number of processors per cluster
     
    133136    giet_proc_xyp( &x, &y, &l );
    134137
    135     // "load" task[0][0] initialises barrier between all load tasks,
    136     // allocates the NIC & CMA RX channels, and start the NIC_CMA RX transfer.
     138    // "load" task[0][0]
     139    // - initialises the heap in every cluster
     140    // - initialises barrier between all load tasks,
     141    // - allocates the NIC & CMA RX channels, and start the NIC_CMA RX transfer.
    137142    // Other "load" tasks wait completion
    138143    if ( (x==0) && (y==0) )
     
    141146                        "  x_size = %d / y_size = %d / nprocs = %d\n",
    142147                        x , y , l , giet_proctime() , x_size, y_size, nprocs );
    143  
     148
     149    unsigned int xid;  // x cluster coordinate index
     150    unsigned int yid;  // y cluster coordinate index
     151
     152    for ( xid = 0 ; xid < x_size ; xid++ )
     153      {
     154        for ( yid = 0 ; yid < y_size ; yid++ )
     155          {
     156            heap_init( xid, yid );
     157          }
     158      }
     159   
     160        global_sync = 1;
     161
    144162        sqt_barrier_init( &rx_barrier, x_size , y_size , 1 );
    145163        nic_rx_channel = giet_nic_rx_alloc( x_size , y_size );
     
    271289    unsigned int    l;
    272290    giet_proc_xyp( &x, &y, &l );
     291
     292    // "Store" tasks wait completion of heaps initialization
     293    while ( global_sync == 0 ) asm volatile ("nop");
    273294
    274295    // "store" task[0][0] initialises the barrier between all "store" tasks,
     
    419440                        x , y , l , giet_proctime() , x_size, y_size, nprocs );
    420441    }
    421  
    422     // all "analyse" tasks wait mwmr channels initialisation
     442
     443    // all "analyse" tasks wait heaps and mwmr channels initialisation
    423444    while ( local_sync[x][y] == 0 ) asm volatile ("nop");
    424445
Note: See TracChangeset for help on using the changeset viewer.