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

StreamCompressionCompiler? initial check-in

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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}
Note: See TracChangeset for help on using the changeset viewer.