Ignore:
Timestamp:
Mar 22, 2018, 2:49:54 AM (19 months ago)
Author:
xwa163
Message:

Fix lz4 related GEP instructions and TODO

File:
1 edited

Legend:

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

    r5885 r5926  
    4848        Value * sourceItemsAvail = mAvailableItemCount[1]; //TODO need to be calculated from numOfStrides
    4949
    50         Value * PDEPStrmPtr = kb->getInputStreamBlockPtr("PDEPmarkerStream", kb->getInt32(0)); // mStreamBufferPtr[0];
    51 
    52 
    53         std::vector<Value*> inputSwizzlesPtrs = std::vector<Value*>(mStreamSize, NULL);
    54         std::vector<Value*> outputStreamPtrs = std::vector<Value*>(mStreamSize, NULL);
    55         for (int i = 0; i < mStreamSize; i++) {
    56             inputSwizzlesPtrs[i] = kb->getInputStreamBlockPtr("sourceStreamSet" + std::to_string(i), kb->getInt32(0));
    57 //            kb->CallPrintInt("@@inputSwizzlesPtrs_" + std::to_string(i), inputSwizzlesPtrs[i]);
    58             // Get pointer to start of the output StreamSetBlock we're currently writing to
    59             outputStreamPtrs[i] = kb->getOutputStreamBlockPtr("outputStreamSet" + std::to_string(i), kb->getInt32(0));
    60         }
    61 
    6250        Constant * blockWidth = kb->getSize(kb->getBitBlockWidth());
    6351        Value * blocksToDo = kb->CreateSelect(mIsFinal, kb->CreateUDivCeil(itemsToDo, blockWidth), kb->CreateUDiv(itemsToDo, blockWidth));
     
    9381        Value * updatedProcessedSourceBits = updatedProcessedSourceBitsPhi;
    9482        Value * updatedSourceItems = sourceItemsRemaining;
    95         Value * PDEP_ms_blk = kb->CreateBlockAlignedLoad(kb->CreateGEP(PDEPStrmPtr, blockOffsetPhi));
     83        Value * PDEP_ms_blk = kb->CreateBlockAlignedLoad(kb->getInputStreamBlockPtr("PDEPmarkerStream", kb->getInt32(0), blockOffsetPhi));
    9684
    9785        const auto PDEP_masks = get_PDEP_masks(kb, PDEP_ms_blk, mPDEPWidth);
     
    124112
    125113                // Load current and next BitBlocks/swizzles
    126                 Value * current_swizzle_ptr = kb->CreateGEP(inputSwizzlesPtrs[iStreamIndex], kb->CreateAdd(kb->CreateMul(current_blk_idx, kb->getSize(mSwizzleFactor)), current_swizzle_idx));
     114                Value* current_swizzle_ptr = kb->getInputStreamBlockPtr("sourceStreamSet" + std::to_string(iStreamIndex), current_swizzle_idx, current_blk_idx);
     115
    127116                Value * current_swizzle = kb->CreateBlockAlignedLoad(current_swizzle_ptr);//Constant::getNullValue(cast<PointerType>(current_swizzle_ptr->getType())->getElementType());
    128117
    129                 Value * next_swizzle_ptr = kb->CreateGEP(inputSwizzlesPtrs[iStreamIndex], kb->CreateAdd(kb->CreateMul(next_blk_idx, kb->getSize(mSwizzleFactor)), next_swizzle_idx));
     118
     119                Value* next_swizzle_ptr = kb->getInputStreamBlockPtr("sourceStreamSet" + std::to_string(iStreamIndex), next_swizzle_idx, next_blk_idx);
    130120                Value * next_swizzle = kb->CreateBlockAlignedLoad(next_swizzle_ptr);//Constant::getNullValue(cast<PointerType>(current_swizzle_ptr->getType())->getElementType());
    131121
     
    161151
    162152                // Store the result
    163                 auto outputPos = kb->CreateGEP(outputStreamPtrs[iStreamIndex], kb->CreateAdd(kb->CreateMul(blockOffsetPhi, kb->getSize(mSwizzleFactor)), kb->getSize(i)));
    164 //                if (iStreamIndex == 0) {
    165 //                    kb->CallPrintInt("dataPtr_" + std::to_string(iStreamIndex) + "_" + std::to_string(i), outputPos);
    166 //                    kb->CallPrintRegister("data_" + std::to_string(iStreamIndex) + "_" + std::to_string(i), result_swizzle);
    167 //                }
     153                Value* outputPos = kb->getOutputStreamBlockPtr("outputStreamSet" + std::to_string(iStreamIndex), kb->getSize(i), blockOffsetPhi);
    168154
    169155                kb->CreateBlockAlignedStore(result_swizzle, outputPos);
Note: See TracChangeset for help on using the changeset viewer.