Changeset 5266


Ignore:
Timestamp:
Jan 17, 2017, 11:40:09 PM (10 months ago)
Author:
cameron
Message:

Fixes

Location:
icGREP/icgrep-devel/icgrep/kernels
Files:
4 edited

Legend:

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

    r5265 r5266  
    244244        for (unsigned i = 0; i < mStreamSetOutputs.size(); i++) {
    245245            Value * preProduced = getProducedItemCount(self, mStreamSetOutputs[i].name);
     246           
    246247            setProducedItemCount(self, mStreamSetOutputs[i].name, iBuilder->CreateAdd(preProduced, segmentItemsProcessed));
     248            //iBuilder->CallPrintInt(mKernelName + " produced ", iBuilder->CreateAdd(preProduced, segmentItemsProcessed));
    247249        }
    248250    }
     
    252254    iBuilder->SetInsertPoint(doFinalBlock);
    253255
    254     Value * remainingItems = iBuilder->CreateSub(producerPos[0], processed);
     256    Value * remainingItems = iBuilder->CreateSub(producerPos[0], getProcessedItemCount(self, mStreamSetInputs[0].name));
    255257    //iBuilder->CallPrintInt(mKernelName + " remainingItems", remainingItems);
    256258   
     
    266268        }
    267269    }
     270    setTerminationSignal(self);
    268271    iBuilder->CreateBr(segmentDone);
    269272   
     
    344347void KernelBuilder::setTerminationSignal(Value * self) const {
    345348    Value * ptr = iBuilder->CreateGEP(self, {iBuilder->getInt32(0), getScalarIndex(terminationSignal)});
     349    //iBuilder->CallPrintInt(mKernelName + " setTermination", getScalarIndex(terminationSignal));
    346350    iBuilder->CreateStore(ConstantInt::get(iBuilder->getInt1Ty(), 1), ptr);
    347351}
  • icGREP/icgrep-devel/icgrep/kernels/kernel.h

    r5265 r5266  
    8585    const std::vector<const parabix::StreamSetBuffer *> & getStreamSetOutputBuffers() const { return mStreamSetOutputBuffers; }
    8686
     87    void setTerminationSignal(llvm::Value * self) const;
    8788
    8889protected:
     
    176177    virtual void setProducedItemCount(llvm::Value * self, const std::string & ssName, llvm::Value * newFieldVal) const;
    177178
    178     void setTerminationSignal(llvm::Value * self) const;
    179179
    180180private:
  • icGREP/icgrep-devel/icgrep/kernels/mmap_kernel.cpp

    r5265 r5266  
    3636    }
    3737    Value * produced = getProducedItemCount(self, "sourceBuffer");
    38     Value * itemsAvail = iBuilder->CreateSub(fileItems, produced);
    39     Value * lessThanFullSegment = iBuilder->CreateICmpULT(itemsAvail, segmentItems);
    40     Value * itemsToDo = iBuilder->CreateSelect(lessThanFullSegment, itemsAvail, segmentItems);
    41     produced = iBuilder->CreateAdd(produced, itemsToDo);
     38   
     39    Value * nextProduced = iBuilder->CreateAdd(produced, segmentItems);
     40    Value * lessThanFullSegment = iBuilder->CreateICmpULT(fileItems, nextProduced);
     41    produced = iBuilder->CreateSelect(lessThanFullSegment, fileItems, nextProduced);
    4242    setProducedItemCount(self, "sourceBuffer", produced);
    4343   
  • icGREP/icgrep-devel/icgrep/kernels/pipeline.cpp

    r5264 r5266  
    134134       
    135135        iBuilder->SetInsertPoint(segmentLoopBody[k]);
     136       
     137        //iBuilder->CallPrintInt(kernels[k]->getName() + " segment #", segNo);
    136138        if (k == last_kernel) {
    137139            segNo->addIncoming(iBuilder->CreateAdd(segNo, ConstantInt::get(size_ty, threadNum)), segmentLoopBody[last_kernel]);
    138140        }
    139        
    140        
    141        
    142        
    143141        std::vector<Value *> doSegmentArgs = {instancePtrs[k], doFinal};
    144142        for (unsigned j = 0; j < kernels[k]->getStreamInputs().size(); j++) {
     
    146144            std::tie(producerKernel, outputIndex) = producerTable[k][j];
    147145            doSegmentArgs.push_back(ProducerPos[producerKernel][outputIndex]);
     146            //iBuilder->CallPrintInt(kernels[k]->getName() + " producerPos[" + std::to_string(j) + "] ", doSegmentArgs.back());
     147
    148148        }
    149149        kernels[k]->createDoSegmentCall(doSegmentArgs);
     
    158158        }
    159159        kernels[k]->releaseLogicalSegmentNo(instancePtrs[k], nextSegNo);
    160         if (k == last_kernel) {
    161             iBuilder->CreateCondBr(doFinal, exitThreadBlock, segmentLoop);
    162         }
    163         else {
    164             iBuilder->CreateBr(segmentWait[k+1]);
    165         }
    166     }
    167    
     160        if (k == last_kernel) break;
     161        iBuilder->CreateBr(segmentWait[k+1]);
     162    }
     163    iBuilder->CreateCondBr(doFinal, exitThreadBlock, segmentLoop);
     164
    168165    iBuilder->SetInsertPoint(exitThreadBlock);
    169166    Value * nullVal = Constant::getNullValue(voidPtrTy);
Note: See TracChangeset for help on using the changeset viewer.