Ignore:
Timestamp:
Nov 18, 2016, 1:46:55 PM (3 years ago)
Author:
nmedfort
Message:

Merged PabloFunction? and PabloKernel? classes. Updated projects where necessary.

Location:
icGREP/icgrep-devel/icgrep/kernels
Files:
1 added
19 edited

Legend:

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

    r5202 r5217  
    44 */
    55
     6#include "cc_kernel.h"
     7#include <re/re_cc.h>
     8#include <cc/cc_compiler.h>
     9#include <pablo/builder.hpp>
    610
    7 #include "cc_kernel.h"
    8 
    9 
     11using namespace cc;
    1012using namespace kernel;
     13using namespace pablo;
     14using namespace re;
    1115
    1216void DirectCharacterClassKernelBuilder::generateDoBlockMethod() {
     
    7175}
    7276
     77ParabixCharacterClassKernelBuilder::ParabixCharacterClassKernelBuilder (
     78IDISA::IDISA_Builder * iBuilder
     79, std::string ccSetName
     80, const std::vector<CC *> & charClasses
     81, unsigned basisBitsCount)
     82: PabloKernel(iBuilder, ccSetName +"_kernel") {
     83
     84    CC_Compiler ccc(this, basisBitsCount);
     85    auto & builder = ccc.getBuilder();
     86    for (CC * cc : charClasses) {
     87        Var * const r = addOutput(cc->canonicalName(re::ByteClass), getStreamSetTy());
     88        builder.createAssign(r, ccc.compileCC("cc", cc, builder));
     89    }
     90
     91}
  • icGREP/icgrep-devel/icgrep/kernels/cc_kernel.h

    r5202 r5217  
    99#include "interface.h"
    1010#include "kernel.h"
    11 #include <re/re_cc.h>
    1211#include <pablo/pablo_kernel.h>
    13 #include <cc/cc_compiler.h>
     12
     13namespace re {
     14    class CC;
     15}
    1416
    1517namespace kernel {
    1618
    1719class KernelBuilder;
    18 
    19 
    2020
    2121class DirectCharacterClassKernelBuilder : public KernelBuilder {
     
    2424    DirectCharacterClassKernelBuilder(IDISA::IDISA_Builder * iBuilder, std::string ccSetName, std::vector<re::CC *> charClasses, unsigned codeUnitSize) :
    2525    KernelBuilder(iBuilder, "cc",
    26                   {Binding{parabix::StreamSetType(iBuilder,1, 8 * codeUnitSize), "codeUnitStream"}},
    27                   {Binding{parabix::StreamSetType(iBuilder,charClasses.size(), 1), "ccStream"}},
     26                  {Binding{iBuilder->getStreamSetTy(1, 8 * codeUnitSize), "codeUnitStream"}},
     27                  {Binding{iBuilder->getStreamSetTy(charClasses.size(), 1), "ccStream"}},
    2828                  {}, {}, {}), mCharClasses(charClasses), mCodeUnitSize(codeUnitSize) {}
    2929   
     
    3535   
    3636};
    37    
    38    
    3937
    4038class ParabixCharacterClassKernelBuilder: public pablo::PabloKernel {
    4139public:
    42     ParabixCharacterClassKernelBuilder(IDISA::IDISA_Builder * iBuilder, std::string ccSetName, std::vector<re::CC *> charClasses, unsigned basisBitsCount) :
    43         PabloKernel(iBuilder, ccSetName +"_kernel", cc::ParabixCharacterClassFunction(ccSetName, charClasses, basisBitsCount)) {}
    44    
     40    ParabixCharacterClassKernelBuilder(IDISA::IDISA_Builder * iBuilder, std::string ccSetName, const std::vector<re::CC *> & charClasses, unsigned basisBitsCount);
    4541};
    46  
    4742
    4843}
  • icGREP/icgrep-devel/icgrep/kernels/deletion.cpp

    r5202 r5217  
    5353    auto savePoint = iBuilder->saveIP();
    5454    Module * m = iBuilder->getModule();
    55    
     55
    5656    Function * doBlockFunction = m->getFunction(mKernelName + doBlock_suffix);
    57    
     57
    5858    iBuilder->SetInsertPoint(BasicBlock::Create(iBuilder->getContext(), "entry", doBlockFunction, 0));
    59    
     59
    6060    Value * self = getParameter(doBlockFunction, "self");
     61
    6162    Value * blockNo = getScalarField(self, blockNoScalar);
    62     Value * inputStreamBlock = getStreamSetBlockPtr(self, "inputStreamSet", blockNo);
    63     Value * outputStreamBlock = getStreamSetBlockPtr(self, "outputStreamSet", blockNo);
    64     Value * delCountBlock = getStreamSetBlockPtr(self, "deletionCounts", blockNo);
    6563
    66     Value * del_mask = iBuilder->CreateBlockAlignedLoad(inputStreamBlock, {iBuilder->getInt32(0), iBuilder->getInt32(mStreamCount)});
    67    
    68     std::vector<Value *> move_masks = parallel_prefix_deletion_masks(iBuilder, mDeletionFieldWidth, del_mask);
    69    
     64    Value * inputStreamPtr = getStreamSetBlockPtr(self, "inputStreamSet", blockNo);
     65
     66    Value * delMaskPtr = getStreamSetBlockPtr(self, "delMaskSet", blockNo);
     67
     68    Value * outputStreamPtr = getStreamSetBlockPtr(self, "outputStreamSet", blockNo);
     69
     70    Value * delCountPtr = getStreamSetBlockPtr(self, "deletionCounts", blockNo);
     71
     72    Value * delMask = iBuilder->CreateBlockAlignedLoad(delMaskPtr, {iBuilder->getInt32(0), iBuilder->getInt32(0)});
     73
     74    std::vector<Value *> move_masks = parallel_prefix_deletion_masks(iBuilder, mDeletionFieldWidth, delMask);
     75
    7076    for (unsigned j = 0; j < mStreamCount; ++j) {
    71         Value * input = iBuilder->CreateBlockAlignedLoad(inputStreamBlock, {iBuilder->getInt32(0), iBuilder->getInt32(j)});
    72         Value * output = apply_parallel_prefix_deletion(iBuilder, mDeletionFieldWidth, del_mask, move_masks, input);
    73         iBuilder->CreateBlockAlignedStore(output, outputStreamBlock, {iBuilder->getInt32(0), iBuilder->getInt32(j)});
     77        Value * input = iBuilder->CreateBlockAlignedLoad(inputStreamPtr, {iBuilder->getInt32(0), iBuilder->getInt32(j)});
     78        Value * output = apply_parallel_prefix_deletion(iBuilder, mDeletionFieldWidth, delMask, move_masks, input);
     79        iBuilder->CreateBlockAlignedStore(output, outputStreamPtr, {iBuilder->getInt32(0), iBuilder->getInt32(j)});
    7480    }
    75     Value * counts = partial_sum_popcount(iBuilder, mDeletionFieldWidth, iBuilder->simd_not(del_mask));
    76     iBuilder->CreateBlockAlignedStore(iBuilder->bitCast(counts), delCountBlock, {iBuilder->getInt32(0), iBuilder->getInt32(0)});
     81    Value * counts = partial_sum_popcount(iBuilder, mDeletionFieldWidth, iBuilder->simd_not(delMask));
     82    iBuilder->CreateBlockAlignedStore(iBuilder->bitCast(counts), delCountPtr, {iBuilder->getInt32(0), iBuilder->getInt32(0)});
    7783    /* Stream deletion has only been applied within fields; the actual number of data items
    7884     * has not yet changed.   */
    7985    Value * produced = getProducedItemCount(self);
    8086    produced = iBuilder->CreateAdd(produced, ConstantInt::get(iBuilder->getSizeTy(), iBuilder->getStride()));
    81     setProducedItemCount(self, produced);   
     87    setProducedItemCount(self, produced);
    8288    iBuilder->CreateRetVoid();
    8389    iBuilder->restoreIP(savePoint);
     
    8793    auto savePoint = iBuilder->saveIP();
    8894    Module * m = iBuilder->getModule();
    89    
     95
    9096    unsigned blockSize = iBuilder->getBitBlockWidth();
    9197    Function * doBlockFunction = m->getFunction(mKernelName + doBlock_suffix);
     
    96102    Value * self = getParameter(finalBlockFunction, "self");
    97103    Value * blockNo = getScalarField(self, blockNoScalar);
    98     Value * inputStreamBlock = getStreamSetBlockPtr(self, "inputStreamSet", blockNo);
     104    Value * delMaskBlock = getStreamSetBlockPtr(self, "delMaskSet", blockNo);
    99105    Value * remaining = iBuilder->CreateZExt(remainingBytes, iBuilder->getIntNTy(blockSize));
    100106    Value * EOF_del = iBuilder->bitCast(iBuilder->CreateShl(Constant::getAllOnesValue(iBuilder->getIntNTy(blockSize)), remaining));
    101     Value * const delmaskPtr = iBuilder->CreateGEP(inputStreamBlock, {iBuilder->getInt32(0), iBuilder->getInt32(16)});
     107    Value * const delmaskPtr = iBuilder->CreateGEP(delMaskBlock, {iBuilder->getInt32(0), iBuilder->getInt32(0)});
    102108    Value * const delmaskVal = iBuilder->CreateBlockAlignedLoad(delmaskPtr);
    103109    iBuilder->CreateBlockAlignedStore(iBuilder->CreateOr(EOF_del, delmaskVal), delmaskPtr);
  • icGREP/icgrep-devel/icgrep/kernels/deletion.h

    r5202 r5217  
    4141    DeletionKernel(IDISA::IDISA_Builder * iBuilder, unsigned fw, unsigned streamCount) :
    4242    KernelBuilder(iBuilder, "del",
    43                   {Binding{StreamSetType(iBuilder,streamCount + 2, 1), "inputStreamSet"}},
    44                   {Binding{StreamSetType(iBuilder,streamCount, 1), "outputStreamSet"},
    45                    Binding{StreamSetType(iBuilder,1, 1), "deletionCounts"}},
     43                  {Binding{iBuilder->getStreamSetTy(streamCount), "inputStreamSet"},
     44                   Binding{iBuilder->getStreamSetTy(), "delMaskSet"}},
     45                  {Binding{iBuilder->getStreamSetTy(streamCount), "outputStreamSet"},
     46                   Binding{iBuilder->getStreamSetTy(), "deletionCounts"}},
    4647                  {}, {}, {}),
    4748    mDeletionFieldWidth(fw),
  • icGREP/icgrep-devel/icgrep/kernels/interface.cpp

    r5202 r5217  
    141141        throw std::runtime_error("Cannot find " + fnName);
    142142    }
    143     std::vector<Value *> args = {self, blksToDo};
    144     return iBuilder->CreateCall(method, args);
     143    return iBuilder->CreateCall(method, {self, blksToDo});
    145144}
    146145
  • icGREP/icgrep-devel/icgrep/kernels/kernel.cpp

    r5203 r5217  
    4141        out << "kernel contains " << mStreamSetInputBuffers.size() << " input buffers for "
    4242            << mStreamSetInputs.size() << " input stream sets.";
    43         llvm::report_fatal_error(out.str());
     43        throw std::runtime_error(out.str());
    4444    }
    4545    if (mStreamSetOutputs.size() != mStreamSetOutputBuffers.size()) {
     
    4848        out << "kernel contains " << mStreamSetOutputBuffers.size() << " output buffers for "
    4949            << mStreamSetOutputs.size() << " output stream sets.";
    50         llvm::report_fatal_error(out.str());
     50        throw std::runtime_error(out.str());
    5151    }
    5252    addScalar(iBuilder->getSizeTy(), blockNoScalar);
     
    187187        Value * ssStructPtr = getStreamSetStructPtr(self, mStreamSetInputs[i].name);
    188188        inbufProducerPtrs.push_back(mStreamSetInputBuffers[i]->getProducerPosPtr(ssStructPtr));
    189         endSignalPtrs.push_back(mStreamSetInputBuffers[i]->hasEndOfInputPtr(ssStructPtr));
     189        endSignalPtrs.push_back(mStreamSetInputBuffers[i]->getEndOfInputPtr(ssStructPtr));
    190190    }
    191191   
     
    453453        inbufProducerPtrs.push_back(mStreamSetInputBuffers[i]->getProducerPosPtr(ssStructPtr));
    454454        inbufConsumerPtrs.push_back(mStreamSetInputBuffers[i]->getConsumerPosPtr(ssStructPtr));
    455         endSignalPtrs.push_back(mStreamSetInputBuffers[i]->hasEndOfInputPtr(ssStructPtr));
     455        endSignalPtrs.push_back(mStreamSetInputBuffers[i]->getEndOfInputPtr(ssStructPtr));
    456456    }
    457457    for (unsigned i = 0; i < mStreamSetOutputs.size(); i++) {
  • icGREP/icgrep-devel/icgrep/kernels/kernel.h

    r5202 r5217  
    5656    llvm::Value * getTerminationSignal(llvm::Value * kernelInstance);
    5757   
     58    inline llvm::IntegerType * getSizeTy() {
     59        return getBuilder()->getSizeTy();
     60    }
     61
     62    inline Type * getStreamSetTy(const unsigned NumElements = 1, const unsigned FieldWidth = 1) {
     63        return getBuilder()->getStreamSetTy(NumElements, FieldWidth);
     64    }
    5865
    5966protected:
     
    122129    void setTerminationSignal(llvm::Value * self);
    123130
    124 
    125131protected:
    126132
  • icGREP/icgrep-devel/icgrep/kernels/p2s_kernel.cpp

    r5202 r5217  
    6767}
    6868       
    69    
    70 void p2sKernel_withCompressedOutput::prepareKernel() {
    71     KernelBuilder::prepareKernel();
    72 }
    73 
    7469void p2sKernel_withCompressedOutput::generateDoBlockMethod() {
    7570    auto savePoint = iBuilder->saveIP();
     
    109104    iBuilder->restoreIP(savePoint);
    110105}
    111    
    112    
     106
    113107void p2s_16Kernel::generateDoBlockMethod() {
    114108    auto savePoint = iBuilder->saveIP();
     
    140134        Value * merge0 = iBuilder->bitCast(iBuilder->esimd_mergel(8, hi_bytes[j], lo_bytes[j]));
    141135        Value * merge1 = iBuilder->bitCast(iBuilder->esimd_mergeh(8, hi_bytes[j], lo_bytes[j]));
    142         iBuilder->CreateBlockAlignedStore(merge0, i16StreamBlock_ptr, {iBuilder->getInt32(0), iBuilder->getInt32(0), iBuilder->getInt32(2*j)});
    143         iBuilder->CreateBlockAlignedStore(merge1, i16StreamBlock_ptr, {iBuilder->getInt32(0), iBuilder->getInt32(0), iBuilder->getInt32(2*j+1)});
    144     }
    145     iBuilder->CreateRetVoid();
    146     iBuilder->restoreIP(savePoint);
    147 }
    148        
    149 
    150 void p2s_16Kernel_withCompressedOutput::prepareKernel() {
    151     KernelBuilder::prepareKernel();
    152 }
    153    
     136        // iBuilder->getInt32(0),
     137        iBuilder->CreateBlockAlignedStore(merge0, i16StreamBlock_ptr, {iBuilder->getInt32(0), iBuilder->getInt32(2*j)});
     138        iBuilder->CreateBlockAlignedStore(merge1, i16StreamBlock_ptr, {iBuilder->getInt32(0), iBuilder->getInt32(2*j+1)});
     139    }
     140    iBuilder->CreateRetVoid();
     141    iBuilder->restoreIP(savePoint);
     142}
    154143
    155144void p2s_16Kernel_withCompressedOutput::generateDoBlockMethod() {
    156145    auto savePoint = iBuilder->saveIP();
    157146    Module * m = iBuilder->getModule();
    158     Type * i32 = iBuilder->getIntNTy(32); 
    159     Type * bitBlockPtrTy = llvm::PointerType::get(iBuilder->getBitBlockType(), 0); 
    160 
    161     Function * doBlockFunction = m->getFunction(mKernelName + doBlock_suffix);
    162    
     147    Type * i32 = iBuilder->getIntNTy(32);
     148    Type * bitBlockPtrTy = llvm::PointerType::get(iBuilder->getBitBlockType(), 0);
     149
     150    Function * doBlockFunction = m->getFunction(mKernelName + doBlock_suffix);
     151
    163152    iBuilder->SetInsertPoint(BasicBlock::Create(iBuilder->getContext(), "entry", doBlockFunction, 0));
    164153    Constant * stride = ConstantInt::get(iBuilder->getSizeTy(), iBuilder->getStride());
     
    170159    Value * i16UnitsGenerated = getProducedItemCount(self); // units generated to buffer
    171160    Value * i16BlockNo = iBuilder->CreateUDiv(i16UnitsGenerated, stride);
    172    
     161
    173162    Value * i16StreamBase_ptr = iBuilder->CreateBitCast(getStreamSetBlockPtr(self, "i16Stream", i16BlockNo), PointerType::get(iBuilder->getInt16Ty(), 0));
    174    
     163
    175164    Value * u16_output_ptr = iBuilder->CreateGEP(i16StreamBase_ptr, iBuilder->CreateURem(i16UnitsGenerated, stride));
    176165
    177    
     166
    178167    Value * hi_input[8];
    179168    for (unsigned j = 0; j < 8; ++j) {
     
    182171    Value * hi_bytes[8];
    183172    p2s(iBuilder, hi_input, hi_bytes);
    184    
     173
    185174    Value * lo_input[8];
    186175    for (unsigned j = 0; j < 8; ++j) {
     
    189178    Value * lo_bytes[8];
    190179    p2s(iBuilder, lo_input, lo_bytes);
    191    
    192     unsigned UTF_16_units_per_register = iBuilder->getBitBlockWidth()/16;
    193    
     180
     181    const auto UTF_16_units_per_register = iBuilder->getBitBlockWidth() / 16;
     182
    194183    Value * unit_counts = iBuilder->fwCast(UTF_16_units_per_register, iBuilder->CreateBlockAlignedLoad(delCountBlock_ptr, {iBuilder->getInt32(0), iBuilder->getInt32(0)}));
    195    
     184
    196185    Value * offset = ConstantInt::get(i32, 0);
    197    
     186
    198187    for (unsigned j = 0; j < 8; ++j) {
    199188        Value * merge0 = iBuilder->bitCast(iBuilder->esimd_mergel(8, hi_bytes[j], lo_bytes[j]));
    200189        Value * merge1 = iBuilder->bitCast(iBuilder->esimd_mergeh(8, hi_bytes[j], lo_bytes[j]));
    201         //iBuilder->CallPrintRegister("merge0", merge0);
    202190        iBuilder->CreateAlignedStore(merge0, iBuilder->CreateBitCast(iBuilder->CreateGEP(u16_output_ptr, offset), bitBlockPtrTy), 1);
    203191        offset = iBuilder->CreateZExt(iBuilder->CreateExtractElement(unit_counts, iBuilder->getInt32(2*j)), i32);
    204         //iBuilder->CallPrintInt("offset", offset);
    205192        iBuilder->CreateAlignedStore(merge1, iBuilder->CreateBitCast(iBuilder->CreateGEP(u16_output_ptr, offset), bitBlockPtrTy), 1);
    206         //iBuilder->CallPrintRegister("merge1", merge1);
    207193        offset = iBuilder->CreateZExt(iBuilder->CreateExtractElement(unit_counts, iBuilder->getInt32(2*j+1)), i32);
    208         //iBuilder->CallPrintInt("offset", offset);
    209     }
    210    
     194    }
     195
    211196    i16UnitsGenerated = iBuilder->CreateAdd(i16UnitsGenerated, iBuilder->CreateZExt(offset, iBuilder->getSizeTy()));
    212197    setProducedItemCount(self, i16UnitsGenerated);
  • icGREP/icgrep-devel/icgrep/kernels/p2s_kernel.h

    r5202 r5217  
    2121    p2sKernel(IDISA::IDISA_Builder * iBuilder) :
    2222    KernelBuilder(iBuilder, "p2s",
    23                   {Binding{StreamSetType(iBuilder,8, 1), "basisBits"}},
    24                   {Binding{StreamSetType(iBuilder,1, 8), "byteStream"}},
     23                  {Binding{iBuilder->getStreamSetTy(8, 1), "basisBits"}},
     24                  {Binding{iBuilder->getStreamSetTy(1, 8), "byteStream"}},
    2525                  {}, {}, {}) {}
    2626   
     
    3434    p2sKernel_withCompressedOutput(IDISA::IDISA_Builder * iBuilder) :
    3535    KernelBuilder(iBuilder, "p2s_compress",
    36                   {Binding{StreamSetType(iBuilder,8, 1), "basisBits"}, Binding{StreamSetType(iBuilder,1, 1), "deletionCounts"}},
    37                   {Binding{StreamSetType(iBuilder,1, 8), "byteStream"}},
     36                  {Binding{iBuilder->getStreamSetTy(8, 1), "basisBits"}, Binding{iBuilder->getStreamSetTy(1, 1), "deletionCounts"}},
     37                  {Binding{iBuilder->getStreamSetTy(1, 8), "byteStream"}},
    3838                  {}, {}, {}) {}
    3939   
    4040private:
    41     void prepareKernel() override;
    4241    void generateDoBlockMethod() override;
    4342};
     
    4847    p2s_16Kernel(IDISA::IDISA_Builder * iBuilder) :
    4948    KernelBuilder(iBuilder, "p2s_16",
    50                   {Binding{StreamSetType(iBuilder,16, 1), "basisBits"}},
    51                   {Binding{StreamSetType(iBuilder,1, 16), "i16Stream"}},
     49                  {Binding{iBuilder->getStreamSetTy(16, 1), "basisBits"}},
     50                  {Binding{iBuilder->getStreamSetTy(1, 16), "i16Stream"}},
    5251                  {}, {}, {}) {}
    5352   
     
    6261    p2s_16Kernel_withCompressedOutput(IDISA::IDISA_Builder * iBuilder) :
    6362    KernelBuilder(iBuilder, "p2s_16_compress",
    64                   {Binding{StreamSetType(iBuilder,16, 1), "basisBits"}, Binding{StreamSetType(iBuilder,1, 1), "deletionCounts"}},
    65                   {Binding{StreamSetType(iBuilder,1, 16), "i16Stream"}},
     63                  {Binding{iBuilder->getStreamSetTy(16, 1), "basisBits"}, Binding{iBuilder->getStreamSetTy(1, 1), "deletionCounts"}},
     64                  {Binding{iBuilder->getStreamSetTy(1, 16), "i16Stream"}},
    6665                  {},
    6766                  {},
     
    6968       
    7069private:
    71     void prepareKernel() override;
    7270    void generateDoBlockMethod() override;
    7371    void generateFinalBlockMethod() override;
  • icGREP/icgrep-devel/icgrep/kernels/pipeline.cpp

    r5202 r5217  
    211211        kernels[i]->createDoSegmentCall(instances[i], segBlocks);
    212212    }
    213     Value * endSignal = kernels[kernels.size()-1]->getTerminationSignal(instances[kernels.size()-1]);
     213    Value * endSignal = kernels.back()->getTerminationSignal(instances.back());
    214214    iBuilder->CreateCondBr(endSignal, exitBlock, segmentBlock);
    215215    iBuilder->SetInsertPoint(exitBlock);
  • icGREP/icgrep-devel/icgrep/kernels/s2p_kernel.cpp

    r5202 r5217  
    162162   
    163163void s2pKernel::generateDoBlockLogic(Value * self, Value * blockNo) {
    164     Value * byteStream = getStreamSetBlockPtr(self, "byteStream", blockNo);
     164
     165    Value * bytePtr = iBuilder->CreateMul(blockNo, ConstantInt::get(blockNo->getType(), 8));
     166    Value * byteStream = getStreamSetBlockPtr(self, "byteStream", bytePtr);
    165167    Value * basisBits = getStreamSetBlockPtr(self, "basisBits", blockNo);
    166168
    167169    Value * bytepack[8];
    168170    for (unsigned i = 0; i < 8; i++) {
    169         bytepack[i] = iBuilder->CreateBlockAlignedLoad(byteStream, {iBuilder->getInt32(0), iBuilder->getInt32(0), iBuilder->getInt32(i)});
     171        Value * ptr = iBuilder->CreateGEP(byteStream, {iBuilder->getInt32(0), iBuilder->getInt32(i)});
     172        bytepack[i] = iBuilder->CreateBlockAlignedLoad(ptr);
    170173    }
    171174    Value * bitblock[8];
  • icGREP/icgrep-devel/icgrep/kernels/s2p_kernel.h

    r5202 r5217  
    2727    s2pKernel(IDISA::IDISA_Builder * iBuilder) :
    2828    KernelBuilder(iBuilder, "s2p",
    29                   {Binding{parabix::StreamSetType(iBuilder,1, 8), "byteStream"}},
    30                   {Binding{parabix::StreamSetType(iBuilder,8, 1), "basisBits"}},
     29                  {Binding{iBuilder->getStreamSetTy(1, 8), "byteStream"}},
     30                  {Binding{iBuilder->getStreamSetTy(8, 1), "basisBits"}},
    3131                  {}, {}, {}) {}
    3232   
  • icGREP/icgrep-devel/icgrep/kernels/scanmatchgen.cpp

    r5206 r5217  
    119119    recordNum_input_parm->setName("lineNum");
    120120   
    121     Constant * matchProcessor;
     121    Constant * matchProcessor = nullptr;
    122122    switch (mGrepType) {
    123123        case GrepType::Normal:
     
    130130            matchProcessor = m->getOrInsertFunction("insert_property_values", Type::getVoidTy(ctxt), T, T, T, S, nullptr);
    131131            break;
    132 
     132        default: llvm_unreachable("unknown grep type");
    133133    }
    134134    iBuilder->SetInsertPoint(BasicBlock::Create(ctxt, "entry", function,0));
     
    213213            iBuilder->CreateCall(matchProcessor, std::vector<Value *>({matchRecordNum_phi, matchRecordStart_phi, matchRecordEnd, fileBuf}));
    214214            break;
     215        default: llvm_unreachable("unknown grep type");
    215216    }
    216217   
  • icGREP/icgrep-devel/icgrep/kernels/scanmatchgen.h

    r5206 r5217  
    2222    ScanMatchKernel(IDISA::IDISA_Builder * iBuilder, GrepType grepType) :
    2323    KernelBuilder(iBuilder, "scanMatch",
    24                   {Binding{parabix::StreamSetType(iBuilder,2, 1), "matchResults"}},
     24                  {Binding{iBuilder->getStreamSetTy(2, 1), "matchResults"}},
    2525                    {},
    2626                    {Binding{iBuilder->getInt8PtrTy(), "FileBuf"}, Binding{iBuilder->getSizeTy(), "FileSize"}, Binding{iBuilder->getSizeTy(), "FileIdx"}},
  • icGREP/icgrep-devel/icgrep/kernels/stdout_kernel.cpp

    r5204 r5217  
    7373    Value * byteOffset = iBuilder->CreateMul(iBuilder->CreateURem(processed, blockItems), itemBytes);
    7474    Value * bytePtr = iBuilder->CreateGEP(iBuilder->CreateBitCast(basePtr, i8PtrTy), byteOffset);
    75 //#undef NDEBUG
    76 #ifndef NDEBUG
    77     iBuilder->CallPrintInt(mKernelName + "_segmentNo", segmentNo);
    78     iBuilder->CallPrintInt(mKernelName + "_itemsAvail", itemsAvail);
    79     iBuilder->CallPrintInt(mKernelName + "_itemsToDo", itemsToDo);
    80 #endif
     75
    8176    iBuilder->CreateCall(writefn, std::vector<Value *>({iBuilder->getInt32(1), bytePtr, iBuilder->CreateMul(itemsToDo, itemBytes)}));
    8277   
     
    8681    mStreamSetInputBuffers[0]->setConsumerPos(streamStructPtr, processed);
    8782
    88     Value * endSignal = iBuilder->CreateLoad(mStreamSetInputBuffers[0]->hasEndOfInputPtr(streamStructPtr));
     83    Value * endSignal = iBuilder->CreateLoad(mStreamSetInputBuffers[0]->getEndOfInputPtr(streamStructPtr));
    8984    Value * inFinalSegment = iBuilder->CreateAnd(endSignal, lessThanFullSegment);
    9085   
    9186    iBuilder->CreateCondBr(inFinalSegment, setTermination, stdOutexit);
    9287    iBuilder->SetInsertPoint(setTermination);
    93 #ifndef NDEBUG
    94     iBuilder->CallPrintInt(mKernelName + " termination in segment ", segmentNo);
    95 #endif
     88
    9689    setTerminationSignal(self);
    9790
  • icGREP/icgrep-devel/icgrep/kernels/stdout_kernel.h

    r5202 r5217  
    1818    stdOutKernel(IDISA::IDISA_Builder * iBuilder, unsigned codeUnitWidth) :
    1919    KernelBuilder(iBuilder, "stdout",
    20                   {Binding{parabix::StreamSetType(iBuilder, 1, codeUnitWidth), "codeUnitBuffer"}}, {}, {}, {}, {}),
     20                  {Binding{iBuilder->getStreamSetTy(1, codeUnitWidth), "codeUnitBuffer"}}, {}, {}, {}, {}),
    2121    mCodeUnitWidth(codeUnitWidth) {}
    2222   
  • icGREP/icgrep-devel/icgrep/kernels/streamset.cpp

    r5204 r5217  
    1414enum SS_struct_index {iProducer_pos = 0, iConsumer_pos = 1, iEnd_of_input = 2, iBuffer_ptr = 3};
    1515
    16 llvm::PointerType * StreamSetBuffer::getStreamBufferPointerType() {
    17     return PointerType::get(mStreamSetType, mAddrSpace);
    18 }
    19 
    20 llvm::PointerType * StreamSetBuffer::getStreamSetStructPointerType() {
    21     return PointerType::get(mStreamSetStructType, 0);
    22 }
    23 
    2416llvm::Value * StreamSetBuffer::getProducerPosPtr(Value * bufferStructPtr) {
    2517    return iBuilder->CreateGEP(bufferStructPtr, {iBuilder->getInt32(0), iBuilder->getInt32(iProducer_pos)});
    2618}
    2719
    28 void StreamSetBuffer::setProducerPos(Value * bufferStructPtr, llvm::Value * pos){
    29     iBuilder->CreateStore(pos, iBuilder->CreateGEP(bufferStructPtr, {iBuilder->getInt32(0), iBuilder->getInt32(iProducer_pos)}));
     20void StreamSetBuffer::setProducerPos(Value * bufferStructPtr, llvm::Value * pos) {
     21    iBuilder->CreateStore(pos, getProducerPosPtr(bufferStructPtr));
    3022}
    3123
     
    3426}
    3527
    36 void StreamSetBuffer::setConsumerPos(Value * bufferStructPtr, Value * pos){
    37     iBuilder->CreateStore(pos, iBuilder->CreateGEP(bufferStructPtr, {iBuilder->getInt32(0), iBuilder->getInt32(iConsumer_pos)}));
     28void StreamSetBuffer::setConsumerPos(Value * bufferStructPtr, Value * pos) {
     29    iBuilder->CreateStore(pos, getConsumerPosPtr(bufferStructPtr));
    3830}
    3931
    40 llvm::Value * StreamSetBuffer::hasEndOfInputPtr(Value * bufferStructPtr) {
     32llvm::Value * StreamSetBuffer::getEndOfInputPtr(Value * bufferStructPtr) {
    4133    return iBuilder->CreateGEP(bufferStructPtr, {iBuilder->getInt32(0), iBuilder->getInt32(iEnd_of_input)});
    4234}
    4335
    44 void StreamSetBuffer::setEndOfInput(Value * bufferStructPtr){
    45     iBuilder->CreateStore(ConstantInt::get(iBuilder->getInt1Ty(), 1), iBuilder->CreateGEP(bufferStructPtr, {iBuilder->getInt32(0), iBuilder->getInt32(iEnd_of_input)}));
     36void StreamSetBuffer::setEndOfInput(Value * bufferStructPtr) {
     37    iBuilder->CreateStore(ConstantInt::get(iBuilder->getInt1Ty(), 1), getEndOfInputPtr(bufferStructPtr));
    4638}
    4739
    48 llvm::Value * StreamSetBuffer::getStreamSetStructPtr(){
    49     return mStreamSetStructPtr;
    50 }
    51 
    52 llvm::Value * StreamSetBuffer::allocateBuffer() {
     40void StreamSetBuffer::allocateBuffer() {
    5341    Type * const size_ty = iBuilder->getSizeTy();
    5442    Type * const int1ty = iBuilder->getInt1Ty();
    5543    mStreamSetBufferPtr = iBuilder->CreateCacheAlignedAlloca(mStreamSetType, ConstantInt::get(iBuilder->getSizeTy(), mBufferBlocks));
    5644    mStreamSetStructPtr = iBuilder->CreateCacheAlignedAlloca(mStreamSetStructType);
    57 
    5845    iBuilder->CreateStore(ConstantInt::get(size_ty, 0), iBuilder->CreateGEP(mStreamSetStructPtr, {iBuilder->getInt32(0), iBuilder->getInt32(iProducer_pos)}));
    5946    iBuilder->CreateStore(ConstantInt::get(size_ty, 0), iBuilder->CreateGEP(mStreamSetStructPtr, {iBuilder->getInt32(0), iBuilder->getInt32(iConsumer_pos)}));
    6047    iBuilder->CreateStore(ConstantInt::get(int1ty, 0), iBuilder->CreateGEP(mStreamSetStructPtr, {iBuilder->getInt32(0), iBuilder->getInt32(iEnd_of_input)}));
    6148    iBuilder->CreateStore(mStreamSetBufferPtr, iBuilder->CreateGEP(mStreamSetStructPtr, {iBuilder->getInt32(0), iBuilder->getInt32(iBuffer_ptr)}));
    62    
    63     return mStreamSetBufferPtr;
    64 }
    65 
    66 llvm::Value * StreamSetBuffer::getStreamSetBlockPointer(llvm::Value * bufferStructPtr, llvm::Value * blockNo) {
    67     Value * handle = iBuilder->CreateGEP(bufferStructPtr, {iBuilder->getInt32(0), iBuilder->getInt32(iBuffer_ptr)});
    68     return iBuilder->CreateGEP(iBuilder->CreateLoad(handle), {blockNo});
    6949}
    7050
    7151// Single Block Buffer
    7252// For a single block buffer, the block pointer is always the buffer base pointer.
    73 llvm::Value * SingleBlockBuffer::getStreamSetBlockPointer(llvm::Value * bufferStructPtr, llvm::Value * blockNo) {
     53llvm::Value * SingleBlockBuffer::getStreamSetBlockPointer(llvm::Value * bufferStructPtr, llvm::Value *) {
    7454    Value * handle = iBuilder->CreateGEP(bufferStructPtr, {iBuilder->getInt32(0), iBuilder->getInt32(iBuffer_ptr)});
    7555    return iBuilder->CreateLoad(handle);
     
    10989}
    11090
    111 llvm::Value * ExternalFileBuffer::allocateBuffer() {
     91void ExternalFileBuffer::allocateBuffer() {
    11292    throw std::runtime_error("External buffers cannot be allocated.");
    11393}
     
    11595llvm::Value * ExternalFileBuffer::getStreamSetBlockPointer(llvm::Value * bufferStructPtr, llvm::Value * blockNo) {
    11696    Value * handle = iBuilder->CreateGEP(bufferStructPtr, {iBuilder->getInt32(0), iBuilder->getInt32(iBuffer_ptr)});
    117     return iBuilder->CreateGEP(iBuilder->CreateLoad(handle), {blockNo});
     97    Value * bufPtr = iBuilder->CreateLoad(handle);
     98    return iBuilder->CreateGEP(bufPtr, blockNo);
    11899}
    119100
     
    121102
    122103llvm::Value * CircularBuffer::getStreamSetBlockPointer(llvm::Value * bufferStructPtr, llvm::Value * blockNo) {
     104    assert (blockNo->getType()->isIntegerTy());
     105
    123106    Value * handle = iBuilder->CreateGEP(bufferStructPtr, {iBuilder->getInt32(0), iBuilder->getInt32(iBuffer_ptr)});
    124     // Circular access is based on blockNo mod mBufferBlocks.  For power of 2 buffer sizes (required), we
    125     // use bitwise masking to efficiently compute the mod function  (blockNo & (mBufferBlocks - 1)
    126107    Value * bufPtr = iBuilder->CreateLoad(handle);
    127     //iBuilder->CallPrintInt("CircularBuffer bufPtr", iBuilder->CreatePtrToInt(bufPtr, iBuilder->getSizeTy()));
    128     return iBuilder->CreateGEP(bufPtr, {iBuilder->CreateAnd(blockNo, ConstantInt::get(iBuilder->getSizeTy(), mBufferBlocks-1))});
     108    Value * offset = nullptr;
     109    if (mBufferBlocks == 1) {
     110        offset = ConstantInt::getNullValue(iBuilder->getSizeTy());
     111    } else if ((mBufferBlocks & (mBufferBlocks - 1)) == 0) { // is power of 2
     112        offset = iBuilder->CreateAnd(blockNo, ConstantInt::get(blockNo->getType(), mBufferBlocks - 1));
     113    } else {
     114        offset = iBuilder->CreateURem(blockNo, ConstantInt::get(blockNo->getType(), mBufferBlocks));
     115    }
     116    return iBuilder->CreateGEP(bufPtr, offset);
    129117}
    130118
     
    136124    Value * handle = iBuilder->CreateGEP(bufferStructPtr, {iBuilder->getInt32(0), iBuilder->getInt32(iBuffer_ptr)});
    137125    Value * bufPtr = iBuilder->CreateLoad(handle);
    138     //iBuilder->CallPrintInt("LinearBuffer bufPtr", iBuilder->CreatePtrToInt(bufPtr, iBuilder->getSizeTy()));
    139126    return iBuilder->CreateGEP(bufPtr, {iBuilder->CreateSub(blockNo, consumerBlock)});
    140127}
     
    144131    Type * const i8 = iBuilder->getInt8Ty();
    145132    Type * const i32 = iBuilder->getInt32Ty();
    146     Type * const i8_ptr = PointerType::get(i8, mAddrSpace);
     133    Type * const i8_ptr = i8->getPointerTo(mAddrSpace);
     134    IntegerType * const sizeTy = iBuilder->getSizeTy();
    147135
     136    Module * const M = iBuilder->getModule();
    148137
    149     Module * M = iBuilder->getModule();
     138    Function * const memmoveFunc = cast<Function>(M->getOrInsertFunction("llvm.memmove.p0i8.p0i8.i" + std::to_string(sizeTy->getBitWidth()),
     139                                                                  iBuilder->getVoidTy(), i8_ptr, i8_ptr, sizeTy, i32, i1, nullptr));
     140    Function * const current = iBuilder->GetInsertBlock()->getParent();
     141    BasicBlock * const copyBackBody = BasicBlock::Create(M->getContext(), "copy_back", current, 0);
     142    BasicBlock * const setConsumerPosExit = BasicBlock::Create(M->getContext(), "setConsumerPos_done", current, 0);
     143    Constant * const blockWidth = ConstantInt::get(sizeTy, iBuilder->getStride());
    150144
    151     IntegerType * sizeTy = iBuilder->getSizeTy();
     145    Constant * const one = ConstantInt::get(sizeTy, 1);
    152146
    153     Function * memmoveFunc = cast<Function>(M->getOrInsertFunction("llvm.memmove.p0i8.p0i8.i" + std::to_string(sizeTy->getBitWidth()),
    154                                                                   iBuilder->getVoidTy(), i8_ptr, i8_ptr, sizeTy, i32, i1, nullptr));
    155     Function * current = iBuilder->GetInsertBlock()->getParent();
    156     BasicBlock * copyBackBody = BasicBlock::Create(M->getContext(), "copy_back", current, 0);
    157     BasicBlock * setConsumerPosExit = BasicBlock::Create(M->getContext(), "setConsumerPos_done", current, 0);
    158     Constant * blockWidth = ConstantInt::get(sizeTy, iBuilder->getStride());
    159     Constant * one = ConstantInt::get(sizeTy, 1);
    160     Value * consumerPos_ptr = iBuilder->CreateGEP(bufferStructPtr, {iBuilder->getInt32(0), iBuilder->getInt32(iConsumer_pos)});
    161     Value * consumerPos = iBuilder->CreateLoad(consumerPos_ptr);
    162     Value * consumerBlock = iBuilder->CreateUDiv(consumerPos, blockWidth);
     147    Value * const consumerPosPtr = getConsumerPosPtr(bufferStructPtr);
     148    Value * const consumerPos = iBuilder->CreateLoad(consumerPosPtr);
     149
    163150    // Ensure that the new consumer position is no less than the current position.
    164151    new_consumer_pos = iBuilder->CreateSelect(iBuilder->CreateICmpULT(new_consumer_pos, consumerPos), consumerPos, new_consumer_pos);
    165152    Value * producerPos = iBuilder->CreateLoad(iBuilder->CreateGEP(bufferStructPtr, {iBuilder->getInt32(0), iBuilder->getInt32(iProducer_pos)}));
     153
    166154    // Ensure that the new consumer position is no greater than the current producer position.
    167155    Value * new_pos_lt_producer_pos = iBuilder->CreateICmpULT(new_consumer_pos, producerPos);
    168156    new_consumer_pos = iBuilder->CreateSelect(new_pos_lt_producer_pos, new_consumer_pos, producerPos);
     157
    169158    // Now, the new_consumer_pos is at most = to the producer_pos; if =, we're done.
    170159    iBuilder->CreateCondBr(new_pos_lt_producer_pos, copyBackBody, setConsumerPosExit);
     
    172161   
    173162    Value * new_consumer_block = iBuilder->CreateUDiv(new_consumer_pos, blockWidth);
    174    
    175163    Value * lastProducerBlock = iBuilder->CreateUDiv(iBuilder->CreateSub(producerPos, one), blockWidth);
    176     //iBuilder->CallPrintInt("new_consumer_block", new_consumer_block);
    177     //iBuilder->CallPrintInt("lastProducerBlock", lastProducerBlock);
    178 
    179164    Value * copyBlocks = iBuilder->CreateAdd(iBuilder->CreateSub(lastProducerBlock, new_consumer_block), one);
    180165
     
    182167
    183168    Constant * blockBytes = ConstantInt::get(sizeTy, dl.getTypeAllocSize(mStreamSetType) * iBuilder->getStride());
     169
    184170    Value * copyLength = iBuilder->CreateMul(copyBlocks, blockBytes);
    185     //iBuilder->CallPrintInt("memmove copyLength", copyLength);
     171
    186172    // Must copy back one full block for each of the streams in the stream set.
    187173    Value * handle = iBuilder->CreateGEP(bufferStructPtr, {iBuilder->getInt32(0), iBuilder->getInt32(iBuffer_ptr)});
    188174    Value * bufferPtr = iBuilder->CreateLoad(handle);
    189     //iBuilder->CallPrintInt("memmove bufferPtr", iBuilder->CreatePtrToInt(bufferPtr, sizeTy));
    190 
     175    Value * const consumerBlock = iBuilder->CreateUDiv(consumerPos, blockWidth);
    191176    Value * copyFrom = iBuilder->CreateGEP(bufferPtr, {iBuilder->CreateSub(new_consumer_block, consumerBlock)});
    192     //iBuilder->CallPrintInt("memmove copyFrom", iBuilder->CreatePtrToInt(copyFrom, sizeTy));
    193     Value * alignment = ConstantInt::get(iBuilder->getInt32Ty(), iBuilder->getBitBlockWidth()/8);
     177    Value * alignment = ConstantInt::get(iBuilder->getInt32Ty(), iBuilder->getBitBlockWidth() / 8);
    194178   
    195179    iBuilder->CreateCall(memmoveFunc, {iBuilder->CreateBitCast(bufferPtr, i8_ptr), iBuilder->CreateBitCast(copyFrom, i8_ptr), copyLength, alignment, ConstantInt::getNullValue(i1)});
     
    197181    // Copy back done, store the new consumer position.
    198182    iBuilder->SetInsertPoint(setConsumerPosExit);
    199     iBuilder->CreateStore(new_consumer_pos, consumerPos_ptr);
     183
     184    iBuilder->CreateStore(new_consumer_pos, consumerPosPtr);
    200185}   
  • icGREP/icgrep-devel/icgrep/kernels/streamset.h

    r5202 r5217  
    1616enum FieldType {i1 = 1, i2 = 2, i4 = 4, i8 = 8, i16 = 16, i32 = 32, i64 = 64, i128 = 128, i256 = 256};
    1717
    18 inline llvm::Type * StreamSetType(IDISA::IDISA_Builder * iBuilder, const unsigned count, const unsigned width) {
    19     llvm::Type * streamType = ((width == 1) ? iBuilder->getBitBlockType() : ArrayType::get(iBuilder->getBitBlockType(), width));
    20     return ArrayType::get(streamType, count);
    21 }
    22 
    23 // Stream Set Structs hold information about the current state
    24 // of a stream set buffer.
     18// Stream Set Structs hold information about the current state of a stream set buffer.
    2519
    2620llvm::Value * getProducerPosPtr(IDISA::IDISA_Builder * b, Value * bufferStructPtr);
    2721llvm::Value * getConsumerPosPtr(IDISA::IDISA_Builder * b, Value * bufferStructPtr);
    28 llvm::Value * hasEndOfInputPtr(IDISA::IDISA_Builder * b, Value * bufferStructPtr);
     22llvm::Value * getEndOfInputPtr(IDISA::IDISA_Builder * b, Value * bufferStructPtr);
    2923llvm::Value * getStreamSetBufferPtr(IDISA::IDISA_Builder * b, Value * bufferStructPtr);
    3024
     
    3428    enum class BufferKind : unsigned {BlockBuffer, ExternalFileBuffer, CircularBuffer, LinearCopybackBuffer};
    3529
    36     inline BufferKind getBufferKind() const {return mBufferKind;}
     30    inline BufferKind getBufferKind() const {
     31        return mBufferKind;
     32    }
    3733
    38     inline llvm::Type * getBufferStreamSetType() {return mStreamSetType;}
     34    inline llvm::Type * getBufferStreamSetType() const {
     35        return mStreamSetType;
     36    }
    3937
    40     llvm::PointerType * getStreamBufferPointerType();
     38    llvm::PointerType * getStreamBufferPointerType() const {
     39        return mStreamSetType->getPointerTo(mAddrSpace);
     40    }
    4141
    42     size_t getBufferSize() { return mBufferBlocks;}
     42    llvm::PointerType * getStreamSetStructPointerType() const {
     43        return mStreamSetStructType->getPointerTo();
     44    }
     45
     46    size_t getBufferSize() const { return mBufferBlocks; }
     47       
     48    llvm::Value * getStreamSetBasePtr() const { return mStreamSetBufferPtr; }
    4349   
    44     virtual llvm::Value * allocateBuffer();
    45    
    46     llvm::Value * getStreamSetBasePtr() {return mStreamSetBufferPtr;}
    47    
     50    llvm::Value * getStreamSetStructPtr() const { return mStreamSetStructPtr; }
     51
     52    virtual void allocateBuffer();
     53
    4854    // Get the buffer pointer for a given block of the stream.
    4955    virtual llvm::Value * getStreamSetBlockPointer(llvm::Value * bufferStructPtr, llvm::Value * blockNo) = 0;
     
    5763    virtual void setConsumerPos(Value * bufferStructPtr, Value * pos);
    5864
    59     llvm::Value * hasEndOfInputPtr(Value * bufferStructPtr);
     65    llvm::Value * getEndOfInputPtr(Value * bufferStructPtr);
    6066
    6167    void setEndOfInput(Value * bufferStructPtr);
    6268   
    63     llvm::Value * getStreamSetBufferPtrPtr(Value * bufferStructPtr);
     69protected:
     70    StreamSetBuffer(BufferKind k, IDISA::IDISA_Builder * b, llvm::Type * type, unsigned blocks, unsigned AddressSpace = 0)
     71    : mBufferKind(k)
     72    , iBuilder(b)
     73    , mStreamSetType(isa<IDISA::StreamType>(type) ? cast<IDISA::StreamType>(type)->resolveType(b) : type)
     74    , mBufferBlocks(blocks)
     75    , mAddrSpace(AddressSpace)
     76    , mStreamSetBufferPtr(nullptr)
     77    , mStreamSetStructPtr(nullptr)
     78    , mStreamSetStructType(StructType::get(b->getContext(),
     79                            {{b->getSizeTy(),
     80                              b->getSizeTy(),
     81                              b->getInt1Ty(),
     82                              PointerType::get(mStreamSetType, AddressSpace)}})) {
    6483
    65     virtual llvm::PointerType * getStreamSetStructPointerType();
    66 
    67     virtual llvm::Value * getStreamSetStructPtr();
    68    
    69 protected:
    70     StreamSetBuffer(BufferKind k, IDISA::IDISA_Builder * b, llvm::Type * type, unsigned blocks, unsigned AddressSpace = 0) :
    71         mBufferKind(k), iBuilder(b), mStreamSetType(type), mBufferBlocks(blocks), mAddrSpace(AddressSpace), mStreamSetBufferPtr(nullptr) {
    72             mStreamSetStructType =
    73                 StructType::get(iBuilder->getContext(),
    74                                 std::vector<Type *>({iBuilder->getSizeTy(),
    75                                                     iBuilder->getSizeTy(),
    76                                                     iBuilder->getInt1Ty(),
    77                                                     PointerType::get(type, AddressSpace)}));
    7884    }
    7985protected:
    8086    const BufferKind        mBufferKind;
    8187    IDISA::IDISA_Builder *  iBuilder;
    82     llvm::Type *            mStreamSetType;
     88    llvm::Type * const      mStreamSetType;
    8389    size_t                  mBufferBlocks;
    8490    int                     mAddrSpace;
    8591    llvm::Value *           mStreamSetBufferPtr;
    8692    llvm::Value *           mStreamSetStructPtr;
    87     llvm::Type *            mStreamSetStructType;
     93    llvm::Type * const      mStreamSetStructType;
    8894};   
    8995
     
    115121
    116122    // Can't allocate - raise an error. */
    117     llvm::Value * allocateBuffer() override;
     123    void allocateBuffer() override;
     124
    118125    llvm::Value * getStreamSetBlockPointer(llvm::Value * bufferStructPtr, llvm::Value * blockNo) override;
    119 
    120126};
    121127   
     
    128134    CircularBuffer(IDISA::IDISA_Builder * b, llvm::Type * type, size_t bufferBlocks, unsigned AddressSpace = 0)
    129135    : StreamSetBuffer(BufferKind::CircularBuffer, b, type, bufferBlocks, AddressSpace) {
    130         if (((bufferBlocks - 1) & bufferBlocks) != 0) {
    131             throw std::runtime_error("CircularStreamSetBuffer: number of blocks must be a power of 2!");
    132         }
     136
    133137    }
    134138
  • icGREP/icgrep-devel/icgrep/kernels/symboltablepipeline.cpp

    r5106 r5217  
    1313#include <kernels/instance.h>
    1414
    15 #include <pablo/function.h>
     15#include <pablo/prototype.h>
    1616#include <pablo/pablo_compiler.h>
    1717#include <pablo/analysis/pabloverifier.hpp>
Note: See TracChangeset for help on using the changeset viewer.