Ignore:
Timestamp:
Mar 11, 2016, 4:44:53 PM (4 years ago)
Author:
nmedfort
Message:

Added ability to name internal state types; removed unnecessary predefined states. Some progress towards supporting segment size > 1

File:
1 edited

Legend:

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

    r4968 r4970  
    1919: mMod(m)
    2020, iBuilder(b)
    21 , mFileBufIdx(7)
    22 , mFileSizeIdx(8)
    23 , mFileNameIdx(9)
    2421, mBitBlockType(b->getBitBlockType())
    2522, mBlockSize(b->getBitBlockWidth()){
     
    3936
    4037    generateS2PKernel(mMod, iBuilder, mS2PKernel);
     38
    4139    generateScanMatch(mMod, iBuilder, 64, mScanMatchKernel, isNameExpression);
    4240
     
    5755}
    5856
    59 void PipelineBuilder::ExecuteKernels(){
     57void PipelineBuilder::ExecuteKernels() {
    6058    Type * T = iBuilder->getIntNTy(64);   
    6159    Type * S = PointerType::get(iBuilder->getIntNTy(8), 0);
     
    9189
    9290
    93     Value * gep = iBuilder->CreateGEP(scanMatchKernelStruct, {iBuilder->getInt32(0), iBuilder->getInt32(0), iBuilder->getInt32(mFileBufIdx)});
     91    Value * gep = mScanMatchKernel->getInternalState("FileBuf", scanMatchKernelStruct);
    9492    Value * filebuf = iBuilder->CreateBitCast(input_param, S);
    9593    iBuilder->CreateStore(filebuf, gep);
    9694
    97     gep = iBuilder->CreateGEP(scanMatchKernelStruct, {iBuilder->getInt32(0), iBuilder->getInt32(0), iBuilder->getInt32(mFileSizeIdx)});
     95
     96    gep = mScanMatchKernel->getInternalState("FileSize", scanMatchKernelStruct);
    9897    iBuilder->CreateStore(buffersize_param, gep);
    9998
    10099
    101     gep = iBuilder->CreateGEP(scanMatchKernelStruct, {iBuilder->getInt32(0), iBuilder->getInt32(0), iBuilder->getInt32(mFileNameIdx)});
     100    gep = mScanMatchKernel->getInternalState("FileName", scanMatchKernelStruct);
    102101    iBuilder->CreateStore(filename_param, gep);
    103102
     
    113112    blkNo_phi->addIncoming(iBuilder->getInt64(0), entry_block);
    114113
    115     Value * final_block_cond = iBuilder->CreateICmpSLT(remaining_phi, ConstantInt::get(T, mBlockSize));
     114    Constant * step = ConstantInt::get(T, mBlockSize * mS2PKernel->getSegmentBlocks());
     115
     116    Value * final_block_cond = iBuilder->CreateICmpSLT(remaining_phi, step);
    116117    iBuilder->CreateCondBr(final_block_cond, pipeline_final_block, pipeline_do_block);
    117118
     
    126127    mScanMatchKernel->generateDoBlockCall(results);
    127128
    128     Value * update_remaining = iBuilder->CreateSub(remaining_phi, iBuilder->getInt64(mBlockSize));
     129    Value * update_remaining = iBuilder->CreateSub(remaining_phi, step);
    129130    remaining_phi->addIncoming(update_remaining, pipeline_do_block);
    130131    iBuilder->CreateBr(pipeline_test_block);
Note: See TracChangeset for help on using the changeset viewer.