Ignore:
Timestamp:
Jul 18, 2016, 11:11:02 AM (3 years ago)
Author:
cameron
Message:

Pipeline generation for kernels with non-void DoBlock? return

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/kernels/pipeline.cpp

    r5096 r5099  
    4242    Value * initialBlockNo = nullptr;
    4343    BasicBlock * initialBlock = nullptr;
     44    Value * rslt = nullptr;
    4445   
    4546    if (segmentSize > 1) {
     
    5758        iBuilder->SetInsertPoint(segmentBodyBlock);
    5859        Value * segBlocks = ConstantInt::get(int64ty, segmentSize);
    59         for (unsigned i = 0; i < kernels.size(); i++) {
    60             kernels[i]->createDoSegmentCall(instances[i], segBlocks);
     60        Value * rslt = kernels[0]->createDoSegmentCall(instances[0], segBlocks);
     61        for (unsigned i = 1; i < kernels.size(); i++) {
     62            rslt = kernels[i]->createDoSegmentCall(instances[i], rslt->getType()->isVoidTy() ? segBlocks : rslt);
    6163        }
    6264        remainingBytes->addIncoming(iBuilder->CreateSub(remainingBytes, step), segmentBodyBlock);
     
    8688    // Full Block Pipeline loop
    8789    iBuilder->SetInsertPoint(fullBodyBlock);
    88    
    89     for (unsigned i = 0; i < kernels.size(); i++) {
    90         kernels[i]->createDoSegmentCall(instances[i], ConstantInt::get(int64ty, 1));
     90    rslt = kernels[0]->createDoSegmentCall(instances[0], ConstantInt::get(int64ty, 1));
     91    for (unsigned i = 1; i < kernels.size(); i++) {
     92        rslt = kernels[i]->createDoSegmentCall(instances[i], rslt->getType()->isVoidTy() ? ConstantInt::get(int64ty, 1) : rslt);
    9193    }
    9294   
     
    9698   
    9799    iBuilder->SetInsertPoint(finalBlock);
    98    
    99     for (unsigned i = 0; i < kernels.size(); i++) {
    100         kernels[i]->createFinalBlockCall(instances[i], remainingBytes);
     100    rslt = kernels[0]-> createFinalBlockCall(instances[0], remainingBytes);
     101    for (unsigned i = 1; i < kernels.size(); i++) {
     102        kernels[i]->createFinalBlockCall(instances[i], rslt->getType()->isVoidTy() ? remainingBytes : rslt);
    101103    }
    102104}
Note: See TracChangeset for help on using the changeset viewer.