Changeset 5950 for icGREP


Ignore:
Timestamp:
Apr 8, 2018, 5:04:12 AM (12 months ago)
Author:
xwa163
Message:

fix bug of swizzled match copy kernel when decompressed file is larger than1gb

File:
1 edited

Legend:

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

    r5941 r5950  
    2222    blockBasePtr = iBuilder->CreatePointerCast(blockBasePtr, iBuilder->getInt64Ty()->getPointerTo());
    2323    // GEP here is safe
    24     return iBuilder->CreateLoad(iBuilder->CreateGEP(blockBasePtr, inputLocalBlockOffset));
     24
     25    Constant* SIZE_ZERO = iBuilder->getSize(0);
     26    Type* int64PtrType = iBuilder->getInt64Ty()->getPointerTo();
     27
     28    Value* tmpOffset = iBuilder->CreateURem(offset, iBuilder->getSize(this->getAnyStreamSetBuffer(bufferName)->getBufferBlocks() * iBuilder->getBitBlockWidth()));
     29    Value* outputRawPtr = iBuilder->CreatePointerCast(iBuilder->getRawInputPointer(bufferName, SIZE_ZERO), int64PtrType);
     30    Value* ptr2 = iBuilder->CreateGEP(outputRawPtr, tmpOffset);
     31
     32
     33    return iBuilder->CreateLoad(ptr2);
    2534}
    2635
     
    109118    iBuilder->SetInsertPoint(loadNextMatchInfoConBlock);
    110119
     120
     121
    111122    Value *hasMoreMatchInfo = iBuilder->CreateICmpULT(phiProcessIndex, totalM0StartItemsCount);
    112123    iBuilder->CreateCondBr(hasMoreMatchInfo, loadNextMatchInfoBodyBlock, processExitBlock);
     
    114125    iBuilder->SetInsertPoint(loadNextMatchInfoBodyBlock);
    115126
    116 
    117     Value *m0StartBaseOffset = iBuilder->CreateURem(initM0StartProcessIndex, SIZE_BIT_BLOCK_WIDTH);
    118     Value *m0StartLoadOffset = iBuilder->CreateAdd(m0StartBaseOffset,
    119                                                    iBuilder->CreateSub(phiProcessIndex, initM0StartProcessIndex));
    120 
    121 
    122     Value *newM0Start = this->loadInt64NumberInput(iBuilder, "m0Start", m0StartLoadOffset);
    123     Value *newM0End = this->loadInt64NumberInput(iBuilder, "m0End", m0StartLoadOffset);
    124     Value *newMatchOffset = this->loadInt64NumberInput(iBuilder, "matchOffset", m0StartLoadOffset);
     127    Value *newM0Start = this->loadInt64NumberInput(iBuilder, "m0Start", phiProcessIndex);
     128    Value *newM0End = this->loadInt64NumberInput(iBuilder, "m0End", phiProcessIndex);
     129    Value *newMatchOffset = this->loadInt64NumberInput(iBuilder, "matchOffset", phiProcessIndex);
    125130
    126131    Value *depositStart = newM0Start;
     
    150155    Value* matchCopyFromBlockIndex = iBuilder->CreateUDiv(matchCopyFromOffset, SIZE_PDEP_WIDTH);
    151156    Value* matchCopyFromBlockOffset = iBuilder->CreateURem(matchCopyFromOffset, SIZE_PDEP_WIDTH);
     157
     158
    152159
    153160    Value* matchCopyTargetBlockIndex = iBuilder->CreateUDiv(iBuilder->CreateSub(phiMatchPos, previousProducedItemCount), SIZE_PDEP_WIDTH);
     
    183190
    184191        Value* outputBlockBasePtr = iBuilder->CreatePointerCast(iBuilder->getOutputStreamBlockPtr("outputStreamSet" + std::to_string(i), SIZE_ZERO), iBuilder->getBitBlockType()->getPointerTo());
     192
    185193        Value* outputTargetBlockPtr = iBuilder->CreateGEP(outputBlockBasePtr, matchCopyTargetBlockIndex);
     194//        iBuilder->CallPrintInt("outputTargetBlockPtr", outputTargetBlockPtr);
    186195        Value* targetOriginalValue = iBuilder->CreateLoad(outputTargetBlockPtr);
    187196
     
    222231    iBuilder->CreateBr(exitBlock);
    223232    iBuilder->SetInsertPoint(exitBlock);
     233//    iBuilder->CallPrintInt("totalM0StartItemsCount", totalM0StartItemsCount);
    224234}
    225235
     
    294304        // Inputs
    295305                           {
    296                                    Binding{iBuilder->getStreamSetTy(1, 64), "m0Start", BoundedRate(0, 1), AlwaysConsume()},
    297                                    Binding{iBuilder->getStreamSetTy(1, 64), "m0End", BoundedRate(0, 1), AlwaysConsume()},
    298                                    Binding{iBuilder->getStreamSetTy(1, 64), "matchOffset", BoundedRate(0, 1), AlwaysConsume()},
     306                                   Binding{iBuilder->getStreamSetTy(1, 64), "m0Start", BoundedRate(0, 1), {DisableTemporaryBuffer(), DisableAvailableItemCountAdjustment(), DisableSufficientChecking()}},
     307                                   Binding{iBuilder->getStreamSetTy(1, 64), "m0End", BoundedRate(0, 1), {DisableTemporaryBuffer(), DisableAvailableItemCountAdjustment(), DisableSufficientChecking()}},
     308                                   Binding{iBuilder->getStreamSetTy(1, 64), "matchOffset", BoundedRate(0, 1), {DisableTemporaryBuffer(), DisableAvailableItemCountAdjustment(), DisableSufficientChecking()}},
    299309
    300310                           },
Note: See TracChangeset for help on using the changeset viewer.