/ani/mrses

To get this branch, use:
bzr branch http://suren.me/webbzr/ani/mrses

« back to all changes in this revision

Viewing changes to cell/mrses_spe.c

  • Committer: Suren A. Chilingaryan
  • Date: 2010-04-28 04:30:08 UTC
  • Revision ID: csa@dside.dyndns.org-20100428043008-vd9z0nso9axezvlp
Initial import

Show diffs side-by-side

added added

removed removed

Lines of Context:
308
308
    short int width;
309
309
    short int walloc, walloc2, dalloc, ralloc;
310
310
    short int index_segment_size; 
311
 
    int i, pos = 0, size;
 
311
    int pos = 0, size;
312
312
    int extra_rows = 0;
313
313
 
314
314
    MRSESTemporaryData data;
359
359
    allocation = (unsigned char*)memalign(HW_ALIGN, size);
360
360
    if (!allocation) return NULL;
361
361
 
362
 
//    memset(allocation, 0, properties * sizeof(uint32_t));
 
362
    memset(allocation, 0, properties * sizeof(uint32_t));
363
363
    
364
364
    data = (MRSESTemporaryData)(allocation + pos);
365
365
    pos += calc_alloc(sizeof(MRSESTemporaryDataS), HW_ALIGN);
399
399
 
400
400
    data->Mfull = (MRSESDataType*)(allocation + pos);
401
401
 
402
 
    size = calc_alloc(properties * sizeof(MRSESDataType), HW_ALIGN);
403
 
    for (i = 0; i < size; i += SPE_MAX_TRANSFER_SIZE) {
404
 
        spu_mfcdma32((void*)(((char *)(data->Mfull)) + i), (unsigned int)(((char*)mrses->mean) + i), min(size - i, SPE_MAX_TRANSFER_SIZE), rdch, MFC_GET_CMD);
405
 
    }
 
402
    spu_mfcdma32((void *)(data->Mfull), (unsigned int)(mrses->mean), calc_alloc(properties * sizeof(MRSESDataType), HW_ALIGN), rdch, MFC_GET_CMD);
406
403
 
407
404
    local_data = (void*)allocation;
408
405
 
437
434
    MRSESDistance dist = mrses->dist;
438
435
 
439
436
    MRSESIntType properties = mrses->properties;
440
 
    MRSESIntType palloc = mrses->palloc;
441
437
    int i, iterations = mrses->iterations;
442
438
 
443
439
    short int iterate_size = mrses->iterate_size;
505
501
    for (l = 0; l < iterate_size; l += pack * at_once) {
506
502
 
507
503
        for (j = 0; j < spe_real_block; j++) {
508
 
            spu_mfcdma32((void *)(index + j * walloc), (unsigned int)(mrses_index + (j + l + block_group * iterate_size) * palloc), walloc * sizeof(MRSESIntType), rdch, MFC_GET_CMD);
 
504
            spu_mfcdma32((void *)(index + j * walloc), (unsigned int)(mrses_index + (j + l + block_group * iterate_size) * properties), walloc * sizeof(MRSESIntType), rdch, MFC_GET_CMD);
509
505
        }
510
506
 
511
507
        (void)spu_mfcstat(MFC_TAG_UPDATE_ALL);
575
571
 
576
572
//                      printf("%i, getting part of index %i, index segment %i\n", k + l, rpl_gen_k, rpl_gen_segment);
577
573
 
578
 
                        spu_mfcdma32((void*)(index_storage_k), (unsigned int)(mrses_index + (l + k + block_group * iterate_size) * palloc + rpl_gen_segment), HW_ALIGN, rdch, MFC_GET_CMD);
 
574
                        spu_mfcdma32((void*)(index_storage_k), (unsigned int)(mrses_index + (l + k + block_group * iterate_size) * properties + rpl_gen_segment), HW_ALIGN, rdch, MFC_GET_CMD);
579
575
                        (void)spu_mfcstat(MFC_TAG_UPDATE_ALL);
580
576
                        
581
577
                        idx = index_storage_k[rpl_gen_k - rpl_gen_segment];
629
625
                            
630
626
                            //printf("%i, write back\n", k);
631
627
                                // write back segment
632
 
                            spu_mfcdma32((void*)(index_storage_k), (unsigned int)(mrses_index + (l + k + block_group * iterate_size) * palloc + rpl_gen_segment), HW_ALIGN, rdch, MFC_PUT_CMD);
 
628
                            spu_mfcdma32((void*)(index_storage_k), (unsigned int)(mrses_index + (l + k + block_group * iterate_size) * properties + rpl_gen_segment), HW_ALIGN, rdch, MFC_PUT_CMD);
633
629
                            //(void)spu_mfcstat(MFC_TAG_UPDATE_ALL);
634
630
                            
635
631
                            //puts("done");
644
640
 
645
641
            // We can write back initial part of index, but we don't really need to
646
642
        for (j = 0; j < spe_real_block; j++) {
647
 
            spu_mfcdma32((void *)(index + j * walloc), (unsigned int)(mrses_index + (j + l + block_group * iterate_size) * palloc), walloc * sizeof(MRSESIntType), rdch, MFC_PUT_CMD);
 
643
            spu_mfcdma32((void *)(index + j * walloc), (unsigned int)(mrses_index + (j + l + block_group * iterate_size) * properties), walloc * sizeof(MRSESIntType), rdch, MFC_PUT_CMD);
648
644
        }
649
645
        (void)spu_mfcstat(MFC_TAG_UPDATE_ALL);
650
646
/*