Ignore:
Timestamp:
Sep 5, 2016, 9:13:11 AM (3 years ago)
Author:
cameron
Message:

ExternalFileBuffer?, SingleBlockBuffer? fixes

File:
1 edited

Legend:

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

    r5135 r5142  
    3434
    3535void KernelBuilder::prepareKernel() {
     36    unsigned blockSize = iBuilder->getBitBlockWidth();
    3637    if (mStreamSetInputs.size() != mStreamSetInputBuffers.size()) {
    3738        throw std::runtime_error("Kernel preparation: Incorrect number of input buffers");
     
    4344    int streamSetNo = 0;
    4445    for (unsigned i = 0; i < mStreamSetInputs.size(); i++) {
     46        size_t bufferSize = mStreamSetInputBuffers[i]->getBufferSize() * blockSize;
    4547        if (!(mStreamSetInputBuffers[i]->getBufferStreamSetType() == mStreamSetInputs[i].ssType)) {
    4648             throw std::runtime_error("Kernel preparation: Incorrect input buffer type");
    4749        }
     50        if ((bufferSize > 0) && (bufferSize < codegen::SegmentSize + (blockSize + mLookAheadPositions - 1)/blockSize)) {
     51             errs() << "buffer size = " << mStreamSetInputBuffers[i]->getBufferSize() << "\n";
     52             throw std::runtime_error("Kernel preparation: Buffer size too small.");
     53        }
     54
    4855        mScalarInputs.push_back(ScalarBinding{mStreamSetInputBuffers[i]->getStreamSetStructPointerType(), mStreamSetInputs[i].ssName + basePtrSuffix});
    4956        mStreamSetNameMap.emplace(mStreamSetInputs[i].ssName, streamSetNo);
Note: See TracChangeset for help on using the changeset viewer.