Ignore:
Timestamp:
Jul 23, 2016, 1:04:44 PM (3 years ago)
Author:
cameron
Message:

Use dynamic size_t determination

File:
1 edited

Legend:

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

    r5104 r5106  
    3737void KernelBuilder::prepareKernel() {
    3838    if (!mDoBlockReturnType) mDoBlockReturnType = iBuilder->getVoidTy();
    39     addScalar(iBuilder->getInt64Ty(), blockNoScalar);
     39    addScalar(iBuilder->getSizeTy(), blockNoScalar);
    4040    int streamSetNo = 0;
    4141    for (auto sSet : mStreamSetInputs) {
     
    154154    iBuilder->SetInsertPoint(blockLoop);
    155155    if (mDoBlockReturnType->isVoidTy()) {
    156         PHINode * blocksRemaining = iBuilder->CreatePHI(iBuilder->getInt64Ty(), 2, "blocksRemaining");
     156        PHINode * blocksRemaining = iBuilder->CreatePHI(iBuilder->getSizeTy(), 2, "blocksRemaining");
    157157        blocksRemaining->addIncoming(blocksToDo, entryBlock);
    158158       
     
    160160       
    161161        iBuilder->CreateCall(doBlockFunction, {self});
    162         setScalarField(self, blockNoScalar, iBuilder->CreateAdd(blockNo, iBuilder->getInt64(1)));
    163         blocksToDo = iBuilder->CreateSub(blocksRemaining, iBuilder->getInt64(1));
     162        setScalarField(self, blockNoScalar, iBuilder->CreateAdd(blockNo, ConstantInt::get(iBuilder->getSizeTy(), 1)));
     163        blocksToDo = iBuilder->CreateSub(blocksRemaining, ConstantInt::get(iBuilder->getSizeTy(), 1));
    164164        blocksRemaining->addIncoming(blocksToDo, blockLoop);
    165         Value * notDone = iBuilder->CreateICmpUGT(blocksToDo, iBuilder->getInt64(0));
     165        Value * notDone = iBuilder->CreateICmpUGT(blocksToDo, ConstantInt::get(iBuilder->getSizeTy(), 0));
    166166        iBuilder->CreateCondBr(notDone, blockLoop, blocksDone);
    167167       
     
    170170    }
    171171    else {
    172         PHINode * blocksRemaining = iBuilder->CreatePHI(iBuilder->getInt64Ty(), 2, "blocksRemaining");
     172        PHINode * blocksRemaining = iBuilder->CreatePHI(iBuilder->getSizeTy(), 2, "blocksRemaining");
    173173        blocksRemaining->addIncoming(blocksToDo, entryBlock);
    174174        PHINode * total = iBuilder->CreatePHI(mDoBlockReturnType, 2, "resultTotal");
     
    179179       
    180180        Value * rslt = iBuilder->CreateCall(doBlockFunction, {self});
    181         setScalarField(self, blockNoScalar, iBuilder->CreateAdd(blockNo, iBuilder->getInt64(1)));
    182         blocksToDo = iBuilder->CreateSub(blocksRemaining, iBuilder->getInt64(1));
     181        setScalarField(self, blockNoScalar, iBuilder->CreateAdd(blockNo, ConstantInt::get(iBuilder->getSizeTy(), 1)));
     182        blocksToDo = iBuilder->CreateSub(blocksRemaining, ConstantInt::get(iBuilder->getSizeTy(), 1));
    183183        blocksRemaining->addIncoming(blocksToDo, blockLoop);
    184         Value * notDone = iBuilder->CreateICmpUGT(blocksToDo, iBuilder->getInt64(0));
     184        Value * notDone = iBuilder->CreateICmpUGT(blocksToDo, ConstantInt::get(iBuilder->getSizeTy(), 0));
    185185        Value * totalSoFar = iBuilder->CreateAdd(total, rslt);
    186186        total->addIncoming(totalSoFar, blockLoop);
Note: See TracChangeset for help on using the changeset viewer.