Ignore:
Timestamp:
Apr 28, 2017, 2:50:59 PM (2 years ago)
Author:
nmedfort
Message:

Refactored source kernels. icgrep from stdin should now be able to handle any file size.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/grep_engine.cpp

    r5425 r5429  
    77#include "grep_engine.h"
    88#include <llvm/IR/Module.h>
    9 #include <llvm/ExecutionEngine/MCJIT.h>
     9//#include <llvm/ExecutionEngine/MCJIT.h>
    1010#include <llvm/IR/Verifier.h>
    1111#include <llvm/Support/CommandLine.h>
     
    1919#include <kernels/streams_merge.h>
    2020#include <kernels/match_count.h>
    21 #include <kernels/mmap_kernel.h>
     21#include <kernels/source_kernel.h>
    2222#include <kernels/s2p_kernel.h>
    2323#include <kernels/scanmatchgen.h>
    2424#include <kernels/streamset.h>
    25 #include <kernels/stdin_kernel.h>
    2625#include <pablo/pablo_kernel.h>
    2726#include <re/re_cc.h>
     
    228227        fileIdx->setName("fileIdx");
    229228
    230         ByteStream = pxDriver.addBuffer(make_unique<SourceFileBuffer>(idb, idb->getStreamSetTy(1, 8)));
    231 
    232         sourceK = pxDriver.addKernelInstance(make_unique<kernel::FileSourceKernel>(idb, idb->getInt8PtrTy(), segmentSize));
     229        ByteStream = pxDriver.addBuffer(make_unique<SourceBuffer>(idb, idb->getStreamSetTy(1, 8)));
     230
     231        sourceK = pxDriver.addKernelInstance(make_unique<kernel::MemorySourceKernel>(idb, idb->getInt8PtrTy(), segmentSize));
    233232        sourceK->setInitialArguments({buffer, length});
    234233
     
    245244        fileIdx->setName("fileIdx");
    246245
     246        ByteStream = pxDriver.addBuffer(make_unique<SourceBuffer>(idb, idb->getStreamSetTy(1, 8)));
     247
    247248        if (grepSource == GrepSource::File) {
    248             ByteStream = pxDriver.addBuffer(make_unique<SourceFileBuffer>(idb, idb->getStreamSetTy(1, 8)));
    249249            sourceK = pxDriver.addKernelInstance(make_unique<kernel::MMapSourceKernel>(idb, segmentSize));
    250250            sourceK->setInitialArguments({fileDescriptor});
    251251        } else { // if (grepSource == GrepSource::StdIn) {
    252             ByteStream = pxDriver.addBuffer(make_unique<ExtensibleBuffer>(idb, idb->getStreamSetTy(1, 8), segmentSize));
    253             sourceK = pxDriver.addKernelInstance(make_unique<kernel::StdInKernel>(idb, segmentSize));
     252            sourceK = pxDriver.addKernelInstance(make_unique<kernel::ReadSourceKernel>(idb, segmentSize));
     253            sourceK->setInitialArguments({idb->getInt32(STDIN_FILENO)});
    254254        }
    255255    }
Note: See TracChangeset for help on using the changeset viewer.