Changeset 487


Ignore:
Timestamp:
Jan 8, 2015, 11:50:25 AM (9 years ago)
Author:
alain
Message:

1) Change the user sbt_barrier_init() prototype: the two (nclusters/ntasks) arguments
replace the single (ntasks) argument.
2) Introduce an explicit (channel) argument in all iuser access functions to the NIC component.
Previously, the channel registered in the task context was an implicit argument.
The channel is still registered in the task context for checking.

Location:
soft/giet_vm/giet_libs
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/giet_libs/barrier.c

    r468 r487  
    9898////////////////////////////////////////////////////
    9999void sbt_barrier_init( giet_sbt_barrier_t*  barrier,
    100                        unsigned int         ntasks )
     100                       unsigned int         nclusters,    // number of clusters
     101                       unsigned int         ntasks )      // tasks per clusters
    101102{
    102103    unsigned int x;          // x coordinate for one SBT node
     
    107108    unsigned int levels;     // depth of the SBT (number of levels)
    108109
    109 
    110110    // compute SBT characteristics
    111     if      ( ntasks == NB_PROCS_MAX      )  // mesh 1*1
     111    if      ( nclusters == 1 )  // mesh 1*1
    112112    {
    113113        x_size    = 1;
     
    115115        levels    = 1;
    116116    }
    117     else if ( ntasks == NB_PROCS_MAX * 2  )  // mesh 2*1
     117    else if ( nclusters == 2 )  // mesh 2*1
    118118    {
    119119        x_size    = 2;
     
    121121        levels    = 2;
    122122    }
    123     else if ( ntasks == NB_PROCS_MAX * 4  )  // mesh 2*2
     123    else if ( nclusters == 4 )  // mesh 2*2
    124124    {
    125125        x_size    = 2;
     
    127127        levels    = 3;
    128128    }
    129     else if ( ntasks == NB_PROCS_MAX * 8  )  // mesh 4*2
     129    else if ( nclusters == 8 )  // mesh 4*2
    130130    {
    131131        x_size    = 4;
     
    133133        levels    = 4;
    134134    }
    135     else if ( ntasks == NB_PROCS_MAX * 16 )  // mesh 4*4
     135    else if ( nclusters == 16 )  // mesh 4*4
    136136    {
    137137        x_size    = 4;
     
    139139        levels    = 5;
    140140    }
    141     else if ( ntasks == NB_PROCS_MAX * 32 )  // mesh 8*4
     141    else if ( nclusters == 32 )  // mesh 8*4
    142142    {
    143143        x_size    = 8;
     
    145145        levels    = 6;
    146146    }
    147     else if ( ntasks == NB_PROCS_MAX * 64 )  // mesh 8*8
     147    else if ( nclusters == 64 )  // mesh 8*8
    148148    {
    149149        x_size    = 8;
     
    151151        levels    = 7;
    152152    }
    153     else if ( ntasks == NB_PROCS_MAX * 128 )  // mesh 16*8
     153    else if ( nclusters == 128 )  // mesh 16*8
    154154    {
    155155        x_size    = 16;
     
    157157        levels    = 8;
    158158    }
    159     else if ( ntasks == NB_PROCS_MAX * 256 )  // mesh 16*16
     159    else if ( nclusters == 256 )  // mesh 16*16
    160160    {
    161161        x_size    = 16;
     
    168168        y_size    = 0;
    169169        levels    = 0;
    170         giet_exit("error in tree_barrier_init() : number of tasks must be power of 2\n");
     170        giet_exit("error in tree_barrier_init() : nclusters must be power of 2\n");
    171171    }
    172172
    173173    // ntasks initialisation
    174     barrier->ntasks = ntasks;
     174    barrier->ntasks = ntasks * nclusters;
    175175   
    176176#if GIET_DEBUG_USER_BARRIER
     
    214214
    215215    // recursively initialize all SBT nodes from root to bottom
    216     sbt_build( barrier, 0, 0, levels-1, NULL );
     216    sbt_build( barrier, 0, 0, levels-1, NULL, ntasks );
    217217
    218218    asm volatile ("sync" ::: "memory");
     
    240240                unsigned int         y,
    241241                unsigned int         level,
    242                 sbt_node_t*          parent )
     242                sbt_node_t*          parent,
     243                unsigned int         ntasks )
    243244{
    244245    // This recursive function initializes the SBT notes
     
    251252    {
    252253        // initializes target node
    253         node->arity    = NB_PROCS_MAX;   
    254         node->count    = NB_PROCS_MAX;   
     254        node->arity    = ntasks;   
     255        node->count    = ntasks;   
    255256        node->sense    = 0;   
    256257        node->level    = 0;   
     
    308309
    309310        // recursive calls for children nodes
    310         sbt_build( barrier , x0 , y0 , level-1 , node );
    311         sbt_build( barrier , x1 , y1 , level-1 , node );
     311        sbt_build( barrier , x0 , y0 , level-1 , node , ntasks );
     312        sbt_build( barrier , x1 , y1 , level-1 , node , ntasks );
    312313    }
    313314
  • soft/giet_vm/giet_libs/barrier.h

    r468 r487  
    1818//    and is implemented as a physically distributed Sliced-Binary-Tree (SBT).
    1919//    WARNING: The following placement constraints must be respected:
    20 //    - The number of tasks must be a power of 2.
    21 //    - There is one task per processor in a given cluster.
     20//    - The number of involved clusters must be a power of 2.
     21//    - The number of involved tasks in a cluster is the same in all clusters.
    2222//    - The involved clusters form a mesh[N][N] or a mesh[N][N/2]
    2323//    - The lower left involved cluster is cluster(0,0) 
     
    8181///////////////////////////////////////////////////////////
    8282extern void sbt_barrier_init( giet_sbt_barrier_t*  barrier,
     83                              unsigned int         nclusters,
    8384                              unsigned int         ntasks );   
    8485
     
    9192                unsigned int         y,
    9293                unsigned int         level,
    93                 sbt_node_t*          parent );
     94                sbt_node_t*          parent,
     95                unsigned int         ntasks );
    9496
    9597///////////////////////////////////////
  • soft/giet_vm/giet_libs/stdio.c

    r461 r487  
    541541//////////////////////////////////////////////////////////////////////////////////
    542542
    543 ////////////////////////
    544 int giet_nic_rx_alloc()
     543////////////////////////////////
     544unsigned int giet_nic_rx_alloc()
    545545{
    546546    int channel = sys_call( SYSCALL_NIC_ALLOC,
    547547                            1,
    548548                            0, 0, 0 );
    549     if ( channel < 0 ) giet_exit("error in giet_nic_tx_alloc()");
    550 
    551     return channel;
    552 }
    553 
    554 ///////////////////////
    555 int giet_nic_tx_alloc()
     549    if ( channel < 0 ) giet_exit("error in giet_nic_rx_alloc()");
     550
     551    return (unsigned int)channel;
     552}
     553
     554////////////////////////////////
     555unsigned int giet_nic_tx_alloc()
    556556{
    557557    int channel = sys_call( SYSCALL_NIC_ALLOC,
     
    560560    if ( channel < 0 ) giet_exit("error in giet_nic_tx_alloc()");
    561561
    562     return channel;
    563 }
    564 
    565 ////////////////////////
    566 void giet_nic_rx_start()
     562    return (unsigned int)channel;
     563}
     564
     565//////////////////////////////////////////////
     566void giet_nic_rx_start( unsigned int channel )
    567567{
    568568    if ( sys_call( SYSCALL_NIC_START,
    569569                   1,
    570                    0, 0, 0 ) ) giet_exit("error in giet_nic_rx_start()");
    571 }
    572 
    573 ////////////////////////
    574 void giet_nic_tx_start()
     570                   channel,
     571                   0, 0 ) ) giet_exit("error in giet_nic_rx_start()");
     572}
     573
     574//////////////////////////////////////////////
     575void giet_nic_tx_start( unsigned int channel )
    575576{
    576577    if ( sys_call( SYSCALL_NIC_START,
    577578                   0,
    578                    0, 0, 0 ) ) giet_exit("error in giet_nic_tx_start()");
     579                   channel,
     580                   0, 0 ) ) giet_exit("error in giet_nic_tx_start()");
    579581}
    580582
     
    599601}
    600602
    601 ///////////////////////
    602 void giet_nic_rx_stop()
     603/////////////////////////////////////////////
     604void giet_nic_rx_stop( unsigned int channel )
    603605{
    604606    if ( sys_call( SYSCALL_NIC_STOP,
    605607                   1,
    606                    0, 0, 0 ) ) giet_exit("error in giet_nic_rx_stop()");
    607 }
    608 
    609 ///////////////////////
    610 void giet_nic_tx_stop()
     608                   channel,
     609                   0, 0 ) ) giet_exit("error in giet_nic_rx_stop()");
     610}
     611
     612/////////////////////////////////////////////
     613void giet_nic_tx_stop( unsigned int channel )
    611614{
    612615    if ( sys_call( SYSCALL_NIC_STOP,
    613616                   0,
    614                    0, 0, 0 ) ) giet_exit("error in giet_nic_tx_stop()");
    615 }
    616 
    617 ////////////////////////
    618 void giet_nic_rx_stats()
     617                   channel,
     618                   0, 0 ) ) giet_exit("error in giet_nic_tx_stop()");
     619}
     620
     621//////////////////////////////////////////////
     622void giet_nic_rx_stats( unsigned int channel )
    619623{
    620624    if ( sys_call( SYSCALL_NIC_STATS,
    621625                   1,
    622                    0, 0, 0 ) ) giet_exit("error in giet_nic_rx_stats()");
    623 }
    624 
    625 ////////////////////////
    626 void giet_nic_tx_stats()
     626                   channel,
     627                   0, 0 ) ) giet_exit("error in giet_nic_rx_stats()");
     628}
     629
     630//////////////////////////////////////////////
     631void giet_nic_tx_stats( unsigned int channel )
    627632{
    628633    if ( sys_call( SYSCALL_NIC_STATS,
    629634                   0,
    630                    0, 0, 0 ) ) giet_exit("error in giet_nic_tx_stats()");
    631 }
    632 
    633 ////////////////////////
    634 void giet_nic_rx_clear()
     635                   channel,
     636                   0, 0 ) ) giet_exit("error in giet_nic_tx_stats()");
     637}
     638
     639//////////////////////////////////////////////
     640void giet_nic_rx_clear( unsigned int channel )
    635641{
    636642    if ( sys_call( SYSCALL_NIC_CLEAR,
    637643                   1,
    638                    0, 0, 0 ) ) giet_exit("error in giet_nic_rx_clear()");
    639 }
    640 
    641 ////////////////////////
    642 void giet_nic_tx_clear()
     644                   channel,
     645                   0, 0 ) ) giet_exit("error in giet_nic_rx_clear()");
     646}
     647
     648//////////////////////////////////////////////
     649void giet_nic_tx_clear( unsigned int channel )
    643650{
    644651    if ( sys_call( SYSCALL_NIC_CLEAR,
    645652                   0,
    646                    0, 0, 0 ) ) giet_exit("error in giet_nic_tx_clear()");
     653                   channel,
     654                   0, 0 ) ) giet_exit("error in giet_nic_tx_clear()");
    647655}
    648656
  • soft/giet_vm/giet_libs/stdio.h

    r468 r487  
    212212//////////////////////////////////////////////////////////////////////////
    213213
    214 extern int giet_nic_rx_alloc();
    215 
    216 extern int giet_nic_tx_alloc();
    217 
    218 extern void giet_nic_rx_start();
    219 
    220 extern void giet_nic_tx_start();
     214extern unsigned int giet_nic_rx_alloc();
     215
     216extern unsigned int giet_nic_tx_alloc();
     217
     218extern void giet_nic_rx_start( unsigned int channel );
     219
     220extern void giet_nic_tx_start( unsigned int channel );
    221221
    222222extern void giet_nic_rx_move( unsigned int channel, void* buffer );
     
    224224extern void giet_nic_tx_move( unsigned int channel, void* buffer );
    225225
    226 extern void giet_nic_rx_stop();
    227 
    228 extern void giet_nic_tx_stop();
    229 
    230 extern void giet_nic_rx_stats();
    231 
    232 extern void giet_nic_tx_stats();
    233 
    234 extern void giet_nic_rx_clear();
    235 
    236 extern void giet_nic_tx_clear();
     226extern void giet_nic_rx_stop( unsigned int channel );
     227
     228extern void giet_nic_tx_stop( unsigned int channel );
     229
     230extern void giet_nic_rx_stats( unsigned int channel );
     231
     232extern void giet_nic_tx_stats( unsigned int channel );
     233
     234extern void giet_nic_rx_clear( unsigned int channel );
     235
     236extern void giet_nic_tx_clear( unsigned int channel );
    237237
    238238//////////////////////////////////////////////////////////////////////////
Note: See TracChangeset for help on using the changeset viewer.