Ignore:
Timestamp:
Mar 29, 2017, 2:29:52 PM (2 years ago)
Author:
nmedfort
Message:

Support for stdin. Needs more testing.

File:
1 edited

Legend:

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

    r5325 r5377  
    1616
    1717namespace kernel {
    18            
     18
    1919void MMapSourceKernel::generateDoSegmentMethod(Value *doFinal, const std::vector<Value *> &producerPos) {
     20
     21    BasicBlock * entryBlock = iBuilder->GetInsertBlock();
    2022    BasicBlock * setTermination = CreateBasicBlock("setTermination");
    2123    BasicBlock * mmapSourceExit = CreateBasicBlock("mmapSourceExit");
     
    2628    }
    2729    Value * produced = getProducedItemCount("sourceBuffer");
    28     Value * nextProduced = iBuilder->CreateAdd(produced, segmentItems);
    29     Value * lessThanFullSegment = iBuilder->CreateICmpULT(fileItems, nextProduced);
    30     produced = iBuilder->CreateSelect(lessThanFullSegment, fileItems, nextProduced);
    31     setProducedItemCount("sourceBuffer", produced);
    32 
     30    produced = iBuilder->CreateAdd(produced, segmentItems);
     31    Value * lessThanFullSegment = iBuilder->CreateICmpULT(fileItems, produced);
    3332    iBuilder->CreateCondBr(lessThanFullSegment, setTermination, mmapSourceExit);
    3433    iBuilder->SetInsertPoint(setTermination);
    3534    setTerminationSignal();
    36     iBuilder->CreateBr(mmapSourceExit);   
     35    iBuilder->CreateBr(mmapSourceExit);
    3736
    3837    iBuilder->SetInsertPoint(mmapSourceExit);
     38
     39    PHINode * itemsRead = iBuilder->CreatePHI(produced->getType(), 2);
     40    itemsRead->addIncoming(produced, entryBlock);
     41    itemsRead->addIncoming(fileItems, setTermination);
     42    setProducedItemCount("sourceBuffer", itemsRead);
    3943}
    4044
     45void MMapSourceKernel::generateInitMethod() {
     46//    Value * fileSize = getScalarField("fileSize");
     47//    fileSize = iBuilder->CreateUDiv(fileSize, iBuilder->getSize(mCodeUnitWidth / 8));
     48//    setProducedItemCount("sourceBuffer", fileSize);
     49}
    4150
    4251MMapSourceKernel::MMapSourceKernel(IDISA::IDISA_Builder * iBuilder, unsigned blocksPerSegment, unsigned codeUnitWidth)
Note: See TracChangeset for help on using the changeset viewer.