Changeset 6037


Ignore:
Timestamp:
May 13, 2018, 9:40:44 PM (3 months ago)
Author:
cameron
Message:

StreamCompressionCompiler? initial check-in

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

Legend:

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

    r6032 r6037  
    119119    pxDriver.makeKernelCall(ccK, {BasisBits}, {CharacterMarkerBuffer});
    120120
    121     StreamSetBuffer * deletedBits = pxDriver.addBuffer<CircularBuffer>(iBuilder, iBuilder->getStreamSetTy(8), inputBufferBlocks);
    122     StreamSetBuffer * deletionCounts = pxDriver.addBuffer<CircularBuffer>(iBuilder, iBuilder->getStreamSetTy(8), inputBufferBlocks);
    123 
    124     Kernel * delK = pxDriver.addKernelInstance<PEXTFieldCompressKernel>(iBuilder, 64, 8);
    125     pxDriver.makeKernelCall(delK, {BasisBits, CharacterMarkerBuffer}, {deletedBits, deletionCounts});
    126 
    127121    StreamSetBuffer * compressedBits = pxDriver.addBuffer<CircularBuffer>(iBuilder, iBuilder->getStreamSetTy(8), inputBufferBlocks);
    128     Kernel * streamCompressionK = pxDriver.addKernelInstance<StreamCompressKernel>(iBuilder, 64, 8);
    129     pxDriver.makeKernelCall(streamCompressionK, {deletedBits, deletionCounts}, {compressedBits});
    130 
     122    StreamFilterCompiler filterCompiler(pxDriver, iBuilder->getStreamSetTy(8), inputBufferBlocks);
     123    filterCompiler.makeCall(CharacterMarkerBuffer, BasisBits, compressedBits);
    131124    return compressedBits;
    132125}
  • icGREP/icgrep-devel/icgrep/kernels/deletion.cpp

    r6035 r6037  
    55
    66#include "deletion.h"
     7#include <toolchain/driver.h>
     8#include <toolchain/cpudriver.h>
    79#include <kernels/kernel_builder.h>
    810#include <llvm/Support/raw_ostream.h>
     11#include <IR_Gen/idisa_target.h>
    912
    1013using namespace llvm;
     
    798801    kb->setProducedItemCount("outputSwizzle0", kb->CreateAdd(pendingOffset, outputProduced));
    799802}
    800 }
     803   
     804void StreamFilterCompiler::makeCall(parabix::StreamSetBuffer * mask, parabix::StreamSetBuffer * inputs, parabix::StreamSetBuffer * outputs) {
     805    if (mBufferBlocks == 0) {
     806        llvm::report_fatal_error("StreamFilterCompiler needs a non-zero bufferBlocks parameter (for now).");
     807    }
     808    auto & iBuilder = mDriver.getBuilder();
     809    unsigned N = IDISA::getNumOfStreams(ssType);
     810    if (IDISA::getStreamFieldWidth(ssType) != 1) {
     811        llvm::report_fatal_error("StreamFilterCompiler only compresses bit streams (for now)");
     812    }
     813    Kernel * compressK = nullptr;
     814    if (AVX2_available()) {
     815        compressK = mDriver.addKernelInstance<PEXTFieldCompressKernel>(iBuilder, mIntraFieldCompressionWidth, N);
     816    } else {
     817        compressK = mDriver.addKernelInstance<FieldCompressKernel>(iBuilder, mIntraFieldCompressionWidth, N);
     818    }
     819    parabix::StreamSetBuffer * compressedFields = mDriver.addBuffer<parabix::CircularBuffer>(iBuilder, iBuilder->getStreamSetTy(N), mBufferBlocks);
     820    parabix::StreamSetBuffer * unitCounts = mDriver.addBuffer<parabix::CircularBuffer>(iBuilder, iBuilder->getStreamSetTy(), mBufferBlocks);
     821   
     822    mDriver.makeKernelCall(compressK, {inputs, mask}, {compressedFields, unitCounts});
     823   
     824    Kernel * streamK = mDriver.addKernelInstance<StreamCompressKernel>(iBuilder, mIntraFieldCompressionWidth, N);
     825    mDriver.makeKernelCall(streamK, {compressedFields, unitCounts}, {outputs});
     826}
     827
     828
     829}
  • icGREP/icgrep-devel/icgrep/kernels/deletion.h

    r6031 r6037  
    88#include "kernel.h"
    99#include <llvm/IR/Value.h>
     10#include <toolchain/driver.h>
     11
    1012namespace IDISA { class IDISA_Builder; }
    1113
    1214namespace kernel {
     15
     16class StreamFilterCompiler {
     17public:
     18    StreamFilterCompiler(Driver & driver, llvm::Type * streamSetType, unsigned bufferBlocks = 0) :
     19    mDriver(driver), ssType(streamSetType), mBufferBlocks(bufferBlocks), mIntraFieldCompressionWidth(64) {}
     20    void setIntraFieldCompressionWidth(unsigned fw) {mIntraFieldCompressionWidth = fw;}
     21    void makeCall(parabix::StreamSetBuffer * mask, parabix::StreamSetBuffer * inputs, parabix::StreamSetBuffer * outputs);
     22private:
     23    Driver & mDriver;
     24    llvm::Type * ssType;
     25    unsigned mBufferBlocks;
     26    unsigned mIntraFieldCompressionWidth;
     27};
    1328
    1429//
Note: See TracChangeset for help on using the changeset viewer.