Changeset 6001


Ignore:
Timestamp:
Apr 29, 2018, 1:01:46 PM (4 months ago)
Author:
cameron
Message:

Multiblock s2p

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

Legend:

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

    r5985 r6001  
    118118#ifdef S2P_MULTIBLOCK
    119119
    120 void S2PKernel::generateMultiBlockLogic(const std::unique_ptr<KernelBuilder> & kb) {
     120void S2PKernel::generateMultiBlockLogic(const std::unique_ptr<KernelBuilder> & kb, Value * const numOfBlocks) {
    121121    BasicBlock * entry = kb->GetInsertBlock();
    122122    BasicBlock * processBlock = kb->CreateBasicBlock("processBlock");
    123123    BasicBlock * s2pDone = kb->CreateBasicBlock("s2pDone");
    124    
    125     Function::arg_iterator args = mCurrentMethod->arg_begin();
    126     args++; //self
    127     Value * itemsToDo = &*(args++);
    128     // Get pointer to start of the StreamSetBlock containing unprocessed input items.
    129     Value * byteStreamPtr = &*(args++);
    130     Value * basisBitsPtr = &*(args++);
    131    
    132     Constant * blockWidth = kb->getSize(kb->getBitBlockWidth());
    133     Value * blocksToDo = kb->CreateCeilUDiv(itemsToDo, blockWidth); // 1 if this is the final block
    134    
     124    Constant * const ZERO = kb->getSize(0);
     125
    135126    kb->CreateBr(processBlock);
    136127   
     
    139130    blockOffsetPhi->addIncoming(kb->getSize(0), entry);
    140131
    141     Value * bytePackPtr = kb->CreateGEP(byteStreamPtr, {blockOffsetPhi, kb->getInt32(0), kb->getInt32(0)});
    142     Value * basisBlockPtr = kb->CreateGEP(basisBitsPtr, blockOffsetPhi);
    143132    Value * bytepack[8];
    144133    for (unsigned i = 0; i < 8; i++) {
    145         bytepack[i] = kb->CreateBlockAlignedLoad(kb->CreateGEP(bytePackPtr, kb->getInt32(i)));
     134        bytepack[i] = kb->loadInputStreamPack("byteStream", ZERO, kb->getInt32(i), blockOffsetPhi);
    146135    }
    147136    Value * basisbits[8];
    148137    s2p(kb, bytepack, basisbits);
    149138    for (unsigned basis_idx = 0; basis_idx < 8; ++basis_idx) {
    150         kb->CreateBlockAlignedStore(basisbits[basis_idx], kb->CreateGEP(basisBlockPtr, {kb->getSize(0), kb->getInt32(basis_idx)}));
     139        kb->storeOutputStreamBlock("basisBits", kb->getInt32(basis_idx), blockOffsetPhi, basisbits[basis_idx]);
    151140    }
    152141    Value * nextBlk = kb->CreateAdd(blockOffsetPhi, kb->getSize(1));
    153     Value * moreToDo = kb->CreateICmpULT(blockOffsetPhi, blocksToDo);
     142    Value * moreToDo = kb->CreateICmpULT(blockOffsetPhi, numOfBlocks);
    154143    blockOffsetPhi->addIncoming(nextBlk, processBlock);
    155144    kb->CreateCondBr(moreToDo, processBlock, s2pDone);
  • icGREP/icgrep-devel/icgrep/kernels/s2p_kernel.h

    r5837 r6001  
    1313namespace llvm { class Value; }
    1414
    15 //#define S2P_MULTIBLOCK
     15#define S2P_MULTIBLOCK
    1616namespace kernel {
    1717#ifdef S2P_MULTIBLOCK
     
    2626protected:
    2727#ifdef S2P_MULTIBLOCK
    28     void generateMultiBlockLogic(const std::unique_ptr<KernelBuilder> & kb) override;
     28    void generateMultiBlockLogic(const std::unique_ptr<KernelBuilder> & kb, llvm::Value * const numOfStrides) override;
    2929#else
    3030    void generateDoBlockMethod(const std::unique_ptr<KernelBuilder> & iBuilder) override;
Note: See TracChangeset for help on using the changeset viewer.