Changeset 5608


Ignore:
Timestamp:
Aug 9, 2017, 11:55:26 PM (2 months ago)
Author:
cameron
Message:

Whole block copying in multiblock kernel builder

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

Legend:

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

    r5600 r5608  
    10561056                Value * allAvail = kb->CreateICmpULE(neededItems, availFromBase);
    10571057                Value * copyItems1 = kb->CreateSelect(allAvail, neededItems, availFromBase);
    1058                 mStreamSetInputBuffers[i]->createBlockAlignedCopy(kb.get(), tempBufPtr, inputPtr, copyItems1);
     1058                //mStreamSetInputBuffers[i]->createBlockAlignedCopy(kb.get(), tempBufPtr, inputPtr, copyItems1);
     1059                Value * copyBlocks1 = kb->CreateUDivCeil(copyItems1, blockSize);
     1060                mStreamSetInputBuffers[i]->createBlockCopy(kb.get(), tempBufPtr, inputPtr, copyBlocks1);
    10591061                BasicBlock * copyRemaining = kb->CreateBasicBlock("copyRemaining");
    10601062                BasicBlock * copyDone = kb->CreateBasicBlock("copyDone");
     
    10621064                kb->SetInsertPoint(copyRemaining);
    10631065                Value * copyItems2 = kb->CreateSub(neededItems, copyItems1);
    1064                 Value * nextBasePos = kb->CreateAdd(blockBasePos, copyItems1);
     1066                Value * copyBlocks2 = kb->CreateUDivCeil(copyItems2, blockSize);
     1067                //Value * nextBasePos = kb->CreateAdd(blockBasePos, copyItems1);
     1068                Value * nextBasePos = kb->CreateAdd(blockBasePos, kb->CreateMul(copyBlocks2, blockSize));
    10651069                Value * nextInputPtr = kb->CreatePointerCast(kb->getRawInputPointer(mStreamSetInputs[i].name, kb->getInt32(0), nextBasePos), bufPtrType);
    10661070                Value * nextBufPtr = kb->CreateGEP(tempBufPtr, kb->CreateUDiv(copyItems1, blockSize));
    1067                 mStreamSetInputBuffers[i]->createBlockAlignedCopy(kb.get(), nextBufPtr, nextInputPtr, copyItems2);
     1071                //mStreamSetInputBuffers[i]->createBlockAlignedCopy(kb.get(), nextBufPtr, nextInputPtr, copyItems2);
     1072                mStreamSetInputBuffers[i]->createBlockCopy(kb.get(), nextBufPtr, nextInputPtr, copyBlocks2);
    10681073                kb->CreateBr(copyDone);
    10691074                kb->SetInsertPoint(copyDone);
     
    10841089        producedItemCount[i] = kb->getProducedItemCount(mStreamSetOutputs[i].name);
    10851090        outputBasePos[i] = kb->CreateAnd(producedItemCount[i], blockBaseMask);
    1086         mStreamSetOutputBuffers[i]->createBlockAlignedCopy(kb.get(), tempBufPtr, outputBlockPtr[i], kb->CreateSub(producedItemCount[i], outputBasePos[i]));
     1091        //mStreamSetOutputBuffers[i]->createBlockAlignedCopy(kb.get(), tempBufPtr, outputBlockPtr[i], kb->CreateSub(producedItemCount[i], outputBasePos[i]));
     1092        Value * copyBlocks = kb->CreateUDivCeil(kb->CreateSub(producedItemCount[i], outputBasePos[i]), blockSize);
     1093        mStreamSetOutputBuffers[i]->createBlockCopy(kb.get(), tempBufPtr, outputBlockPtr[i], copyBlocks);
    10871094        tempArgs.push_back(tempBufPtr);
    10881095    }
     
    11061113        Value * allWritable = kb->CreateICmpULE(copyItems, writableFromBase);
    11071114        Value * copyItems1 = kb->CreateSelect(allWritable, copyItems, writableFromBase);
    1108         mStreamSetOutputBuffers[i]->createBlockAlignedCopy(kb.get(), outputBlockPtr[i], tempBufPtr, copyItems1);
     1115        //mStreamSetOutputBuffers[i]->createBlockAlignedCopy(kb.get(), outputBlockPtr[i], tempBufPtr, copyItems1);
     1116        Value * copyBlocks1 = kb->CreateUDivCeil(copyItems1, blockSize);
     1117        mStreamSetOutputBuffers[i]->createBlockCopy(kb.get(), outputBlockPtr[i], tempBufPtr, copyBlocks1);
    11091118        BasicBlock * copyBackRemaining = kb->CreateBasicBlock("copyBackRemaining");
    11101119        BasicBlock * copyBackDone = kb->CreateBasicBlock("copyBackDone");
     
    11161125        Value * nextOutputPtr = kb->CreatePointerCast(kb->getRawOutputPointer(mStreamSetOutputs[i].name, kb->getInt32(0), nextBasePos), bufPtrType);
    11171126        tempBufPtr = kb->CreateGEP(tempBufPtr, kb->CreateUDiv(copyItems1, blockSize));
    1118         mStreamSetOutputBuffers[i]->createBlockAlignedCopy(kb.get(), nextOutputPtr, tempBufPtr, copyItems2);
     1127        //mStreamSetOutputBuffers[i]->createBlockAlignedCopy(kb.get(), nextOutputPtr, tempBufPtr, copyItems2);
     1128        Value * copyBlocks2 = kb->CreateUDivCeil(copyItems2, blockSize);
     1129        mStreamSetOutputBuffers[i]->createBlockCopy(kb.get(), nextOutputPtr, tempBufPtr, copyBlocks2);
    11191130        kb->CreateBr(copyBackDone);
    11201131        kb->SetInsertPoint(copyBackDone);
  • icGREP/icgrep-devel/icgrep/pablo/optimizers/distributivepass.cpp

    r5607 r5608  
    13431343                }
    13441344            } else if (requiredOperands(typeId) == n) {
    1345                 bool used[n] = { false };
     1345                bool used[n];
     1346                std::fill_n(used, n, false);
    13461347                for (auto e : make_iterator_range(in_edges(u, G))) {
    13471348                    const auto i = G[e];
Note: See TracChangeset for help on using the changeset viewer.