Changeset 307 for soft/giet_vm


Ignore:
Timestamp:
Apr 21, 2014, 5:17:36 AM (11 years ago)
Author:
alain
Message:

Reducing the number of log messages to be compatible with 64 processors architectures.

Location:
soft/giet_vm/transpose
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/transpose/main.c

    r295 r307  
    99//
    1010// - The image size NN must be a power of 2.
    11 // - The number of clusters containing processors (X_SIZE*Y_SIZE-1) must be a power of 2.
     11// - The number of clusters containing processors must be a power of 2.
    1212// - The number of processors per cluster (NB_PROCS_MAX) must be a power of 2.
    1313// - The image size NN must be larger or equal to the total number of processor.
     
    2626#define FILE_PATHNAME       "misc/images.raw"   // file pathname on disk
    2727
    28 #define VERBOSE_OK          0                   // display a detailed log on TTY  when non zero
    2928#define INSTRUMENTATION_OK  0                   // display statistcs on TTY when non zero
    3029
     
    4847unsigned char*  buf_out[32];
    4948
    50 // array of heap names
    51 // one heap per cluster
    52 char*        heap_name[32] = { "trsp_heap_0" , "trsp_heap_1" , "trsp_heap_2" , "trsp_heap_3" ,
    53                                "trsp_heap_4" , "trsp_heap_5" , "trsp_heap_6" , "trsp_heap_7" ,
    54                                "trsp_heap_8" , "trsp_heap_9" , "trsp_heap_10", "trsp_heap_11",
    55                                "trsp_heap_12", "trsp_heap_13", "trsp_heap_14", "trsp_heap_15",
    56                                "trsp_heap_16", "trsp_heap_17", "trsp_heap_18", "trsp_heap_19",
    57                                "trsp_heap_20", "trsp_heap_21", "trsp_heap_22", "trsp_heap_23",
    58                                "trsp_heap_24", "trsp_heap_25", "trsp_heap_26", "trsp_heap_27",
    59                                "trsp_heap_28", "trsp_heap_29", "trsp_heap_30", "trsp_heap_31" };
    60 
    6149// checksum variables
    6250unsigned check_line_before[NN];
     
    7664{
    7765
    78     int          file;                                          // file descriptor for images
    79     unsigned int l;                                             // line index for loops
    80     unsigned int p;                                             // pixel index for loops
    81     unsigned int proc_id     = giet_procid();                   // processor id
    82     unsigned int nclusters   = X_SIZE*(Y_SIZE-1);               // number of clusters with procs
    83     unsigned int lpid        = proc_id % NB_PROCS_MAX;          // local processor id
    84     unsigned int cluster_xy  = proc_id / NB_PROCS_MAX;          // cluster index (8 bits format)
    85     unsigned int x           = cluster_xy >> Y_WIDTH;           // x coordinate
    86     unsigned int y           = cluster_xy & ((1<<Y_WIDTH)-1);   // y coordinate
    87     unsigned int ntasks      = nclusters * NB_PROCS_MAX;        // number of tasks
    88     unsigned int npixels     = NN * NN;                         // number of pixel per image
    89     unsigned int nblocks     = npixels / 512;                   // number of blocks per image
    90     unsigned int image       = 0;
    91  
    92     // cluster_id is a "continuous" index from (0 to nclusters-1)
    93     // for a cluster with coordinates (x,y)
    94     unsigned int cluster_id  = (x * (Y_SIZE-1)) + y;               
    95 
    96     // task_id is a "continuous" index (from 0 to ntasks-1
    97     // for the the task running on processor[x,y,lpid]
    98     unsigned int task_id = (cluster_id * NB_PROCS_MAX) + lpid;
    99 
    100     giet_shr_printf("\n*** Proc [%d,%d,%d] enters main() at cycle %d ***\n",
    101                     x, y, lpid, giet_proctime() );
     66    int          file;                                             // file descriptor for images
     67    unsigned int l;                                                // line index for loops
     68    unsigned int p;                                                // pixel index for loops
     69
     70    unsigned int proc_id     = giet_procid();                      // processor id
     71    unsigned int lpid        = proc_id % NB_PROCS_MAX;             // local processor id
     72    unsigned int cluster_xy  = proc_id / NB_PROCS_MAX;             // cluster index (8 bits format)
     73    unsigned int x           = cluster_xy >> Y_WIDTH;              // x coordinate
     74    unsigned int y           = cluster_xy & ((1<<Y_WIDTH)-1);      // y coordinate
     75
     76    unsigned int npixels     = NN * NN;                            // number of pixel per image
     77    unsigned int nblocks     = npixels / 512;                      // number of blocks per image
     78    unsigned int image       = 0;                                  // image counter
     79
     80    unsigned int nclusters   = X_SIZE * Y_SIZE;                    // number of clusters with procs
     81    unsigned int cluster_id  = (x * Y_SIZE) + y;                   // "continuous" cluster index   
     82    unsigned int ntasks      = nclusters * NB_PROCS_MAX;           // number of tasks
     83    unsigned int task_id     = (cluster_id * NB_PROCS_MAX) +lpid;  // "continuous" task index
    10284
    10385    // processor [0,0,0] makes parameters checking and barriers initialization
     
    126108        giet_shr_printf("\n*** Proc [%d,%d,%d] completes barrier init at cycle %d\n",
    127109                        0, 0, 0, giet_proctime() );
     110
    128111        init_ok = 0;
    129112    }
     
    136119    // (one buf_in and one buf_out per cluster).
    137120    // Each buffer contains (NN*NN / nclusters) bytes.
    138     // They are allocated in the cluster heap by processor with (lpid == 0).
     121    // They are allocated in the cluster[x,y] heap by processor[x,y,0]
    139122    if ( lpid == 0 )
    140123    {
    141         unsigned int heap_base;
    142         giet_vobj_get_vbase( "transpose",
    143                              heap_name[cluster_id],
    144                              &heap_base );
    145 
    146         buf_in[cluster_id]  = (unsigned char*)heap_base;
    147         buf_out[cluster_id] = (unsigned char*)(heap_base + NN*NN/nclusters);
     124        // get heap vaddr in cluster[0,0]
     125        unsigned int heap_base;         
     126        giet_vobj_get_vbase( "transpose", "heap_0_0", &heap_base );
     127 
     128        // allocate buffers in cluster[x,y]
     129        buf_in[cluster_id]  = ((unsigned char*)heap_base) + (cluster_xy << 20);
     130        buf_out[cluster_id] = buf_in[cluster_id] + NN*NN/nclusters;
    148131
    149132        giet_shr_printf("\n*** Proc [%d,%d,%d] completes buffer allocation at cycle %d\n"
     
    157140        file = giet_fat_open( "misc/images.raw", 0);
    158141
    159         giet_assert( (file >= 0),
    160                      "[TRANSPOSE ERROR] cannot open file misc/images.raw");
    161 
    162         giet_shr_printf("\n*** Proc [%d,%d,%d] completes _fat_open at cycle %d\n",
    163                             x, y, 0, giet_proctime() );
     142        if (file < 0)
     143        {
     144            giet_shr_printf("[TRANSPOSE ERROR] Processor[%d,%d,%d]"
     145                            " cannot open file misc/images.raw",
     146                            x, y, lpid );
     147            giet_exit(" open() failure");
     148        }
    164149    }
    165150
    166     //////////////////////////////////////////////////
    167     // all tasks wait buffer allocation completion
    168     //////////////////////////////////////////////////
     151    ///////////////////////////
    169152    barrier_wait( &barrier_0 );
    170153
     
    179162        if (lpid == 0)
    180163        {
    181             giet_shr_printf("\n*** Proc [%d,%d,%d] starts load for image %d at cycle %d\n",
    182                            x, y, 0, image, giet_proctime() );
    183 
    184164            giet_fat_read( file,
    185165                           buf_in[cluster_id],
     
    193173        LOAD_END[cluster_id][lpid] = giet_proctime();
    194174
    195         //////////////////////////////////////////////////
    196         // all tasks wait buf_in load completion
    197         //////////////////////////////////////////////////
     175        ///////////////////////////
    198176        barrier_wait( &barrier_1 );
    199177
     
    203181        // (p,l) are the absolute pixel coordinates in the source image
    204182
    205         giet_shr_printf("\n*** proc [%d,%d,%d] starts transpose for image %d at cycle %d\n",
    206                         x, y, lpid, image, giet_proctime());
    207183
    208184        TRSP_START[cluster_id][lpid] = giet_proctime();
     
    223199        for ( l = first ; l < last ; l++ )
    224200        {
    225 
    226 #if VERBOSE_OK
    227 giet_shr_printf(" - Proc[%d,%d,%d] process line %d\n", x, y, lpid, l );
    228 #endif
    229 
    230201            check_line_before[l] = 0;
    231202         
     
    248219        }
    249220
    250         giet_shr_printf("\n*** proc [%d,%d,%d] completes transpose for image %d at cycle %d\n",
    251                         x, y, lpid, image, giet_proctime() );
    252 
     221        if ( lpid == 0 )
     222        {
     223            giet_shr_printf("\n*** proc [%d,%d,0] completes transpose for image %d at cycle %d\n",
     224                        x, y, image, giet_proctime() );
     225
     226        }
    253227        TRSP_END[cluster_id][lpid] = giet_proctime();
    254228
    255         //////////////////////////////////////////////////
    256         // all tasks wait transpose completion
    257         //////////////////////////////////////////////////
     229        ///////////////////////////
    258230        barrier_wait( &barrier_2 );
    259231
     
    261233        // all processors contribute to display using memcpy...
    262234
    263         if ( ( X_IO != 0) || (Y_IO != 0) )  // external frame buffer available
    264         {
    265             giet_shr_printf("\n*** proc [%d,%d,%d] starts display for image %d at cycle %d\n",
    266                             x, y, lpid, image, giet_proctime() );
    267 
     235        if ( USE_FBF )  // external frame buffer available
     236        {
    268237            DISP_START[cluster_id][lpid] = giet_proctime();
    269238
     
    274243                                npt );
    275244
    276             giet_shr_printf("\n*** Proc [%d,%d,%d] completes display for image %d at cycle %d\n",
    277                             x, y, lpid, image, giet_proctime() );
     245            if ( lpid == 0 )
     246            {
     247                giet_shr_printf("\n*** Proc [%d,%d,0] completes display for image %d at cycle %d\n",
     248                                x, y, image, giet_proctime() );
     249            }
    278250
    279251            DISP_END[cluster_id][lpid] = giet_proctime();
    280252
    281             //////////////////////////////////////////////////
    282             // all tasks wait display completion
    283             //////////////////////////////////////////////////
     253            ///////////////////////////
    284254            barrier_wait( &barrier_3 );
    285255        }
     
    289259        if ( lpid == 0 )
    290260        {
    291             giet_shr_printf("\n*** Proc [%d,%d,%d] starts checks for image %d at cycle %d\n",
    292                             x, y, lpid, image, giet_proctime() );
    293 
    294261            unsigned int success = 1;
    295262            unsigned int start   = cluster_id * nlc;
     
    311278                }
    312279
    313 #if VERBOSE_OK
    314 giet_shr_printf(" - l = %d / before = %d / after = %d \n",
    315                 l, check_line_before[l], check_line_after[l] );
    316 #endif
    317280                if ( check_line_before[l] != check_line_after[l] ) success = 0;
    318281            }
  • soft/giet_vm/transpose/transpose.ld

    r295 r307  
    33*****************************************************************************/
    44
    5 seg_code_base      = 0x00400000;
    6 seg_data_base      = 0x00500000;
     5seg_code_base      = 0x10000000;
     6seg_data_base      = 0x20000000;
    77
    88/***************************************************************************
Note: See TracChangeset for help on using the changeset viewer.