Ignore:
Timestamp:
Jul 25, 2018, 2:50:09 AM (11 months ago)
Author:
xwa163
Message:
  1. Add sourceCC in multiplexed CC
  2. Remove workaround FakeBasisBits? from ICGrep
  3. Implement Swizzled version of LZParabix
  4. Init checkin for SwizzleByGather? Kernel
Location:
icGREP/icgrep-devel/icgrep/kernels
Files:
6 added
2 deleted
6 edited

Legend:

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

    r6111 r6133  
    99namespace kernel {
    1010
     11    FakeStreamGeneratingKernel::FakeStreamGeneratingKernel(const std::unique_ptr<kernel::KernelBuilder> &b,
     12                                                                 const unsigned numberOfInputStream,
     13                                                                 const unsigned numberOfOutputStream,
     14                                                                 std::string name)
     15            : FakeStreamGeneratingKernel(b, numberOfInputStream, std::vector<unsigned>({numberOfOutputStream}), name) {
     16
     17    }
    1118
    1219    FakeStreamGeneratingKernel::FakeStreamGeneratingKernel(const std::unique_ptr<kernel::KernelBuilder> &b,
    13                                                                  const unsigned int numberOfInputStream,
    14                                                                  const unsigned int numberOfOutputStream,
    15                                                                  std::string name)
     20                                                           const unsigned numberOfInputStream,
     21                                                           std::vector<unsigned> numbersOfOutputStreams,
     22                                                           std::string name)
    1623            : MultiBlockKernel(std::move(name),
    1724// input stream sets
    1825                               {Binding{b->getStreamSetTy(numberOfInputStream), "inputStream", FixedRate(), Principal()}},
    1926// output stream set
    20                                {Binding{b->getStreamSetTy(numberOfOutputStream), "outputStream", RateEqualTo("inputStream")}},
     27                               {},
    2128                               {}, {}, {}) {
    22 
     29        for (unsigned i = 0; i < numbersOfOutputStreams.size(); i++) {
     30            mStreamSetOutputs.push_back(Binding{b->getStreamSetTy(numbersOfOutputStreams[i]), "outputStream" + std::to_string(i), RateEqualTo("inputStream")});
     31        }
    2332    }
    2433
    2534    void FakeStreamGeneratingKernel::generateMultiBlockLogic(const std::unique_ptr<KernelBuilder> &b,
    26                                                                 llvm::Value *const numOfStrides) {
     35                                                             llvm::Value *const numOfStrides) {
    2736    }
     37
    2838}
  • icGREP/icgrep-devel/icgrep/kernels/fake_stream_generating_kernel.h

    r6111 r6133  
    66#include <llvm/IR/Value.h>
    77#include <string>
     8#include <vector>
    89
    910namespace IDISA { class IDISA_Builder; }
     
    1314    class FakeStreamGeneratingKernel final : public MultiBlockKernel {
    1415    public:
    15         FakeStreamGeneratingKernel(const std::unique_ptr<kernel::KernelBuilder> & b, const unsigned numberOfInputStream = 1, const unsigned numberOfOutputStream = 1, std::string name = "LZ4FakeStreamGeneratingKernel");
     16        FakeStreamGeneratingKernel(const std::unique_ptr<kernel::KernelBuilder> & b, const unsigned numberOfInputStream = 1, const unsigned numberOfOutputStreams = 1, std::string name = "LZ4FakeStreamGeneratingKernel");
     17        FakeStreamGeneratingKernel(const std::unique_ptr<kernel::KernelBuilder> & b, const unsigned numberOfInputStream, std::vector<unsigned> numbersOfOutputStreams, std::string name = "LZ4FakeStreamGeneratingKernel");
    1618        bool isCachable() const override { return true; }
    1719        bool hasSignature() const override { return false; }
  • icGREP/icgrep-devel/icgrep/kernels/grep_kernel.cpp

    r6127 r6133  
    250250}
    251251
    252 ICGrepKernel::ICGrepKernel(const std::unique_ptr<kernel::KernelBuilder> & b, RE * const re, std::vector<std::string> externals, std::vector<cc::Alphabet *> alphabets, cc::BitNumbering basisSetNumbering, bool fakeBasisBits)
     252ICGrepKernel::ICGrepKernel(const std::unique_ptr<kernel::KernelBuilder> & b, RE * const re, std::vector<std::string> externals, std::vector<cc::Alphabet *> alphabets, cc::BitNumbering basisSetNumbering)
    253253: ICGrepSignature(re)
    254254, PabloKernel(b, "ic" + sha1sum(mSignature),
     
    259259, mExternals(externals)
    260260, mAlphabets(alphabets)
    261 , mBasisSetNumbering(basisSetNumbering)
    262 , mFakeBasisBits(fakeBasisBits){
     261, mBasisSetNumbering(basisSetNumbering) {
    263262}
    264263
     
    269268void ICGrepKernel::generatePabloMethod() {
    270269    PabloBuilder pb(getEntryScope());
    271     cc::Parabix_CC_Compiler ccc(getEntryScope(), getInputStreamSet("basis"), mBasisSetNumbering, mFakeBasisBits);
    272     RE_Compiler re_compiler(getEntryScope(), ccc, mBasisSetNumbering, mFakeBasisBits);
     270    cc::Parabix_CC_Compiler ccc(getEntryScope(), getInputStreamSet("basis"), mBasisSetNumbering);
     271    RE_Compiler re_compiler(getEntryScope(), ccc, mBasisSetNumbering);
    273272    for (auto & e : mExternals) {
    274273        re_compiler.addPrecompiled(e, pb.createExtract(getInputStreamVar(e), pb.getInteger(0)));
  • icGREP/icgrep-devel/icgrep/kernels/grep_kernel.h

    r6127 r6133  
    6262class ICGrepKernel : public ICGrepSignature, public pablo::PabloKernel {
    6363public:
    64     ICGrepKernel(const std::unique_ptr<kernel::KernelBuilder> & iBuilder, re::RE * const re_ast, std::vector<std::string> externals, std::vector<cc::Alphabet *> alphabets = {}, cc::BitNumbering basisSetNumbering = cc::BitNumbering::LittleEndian, bool fakeBasisBits = false);
     64    ICGrepKernel(const std::unique_ptr<kernel::KernelBuilder> & iBuilder, re::RE * const re_ast, std::vector<std::string> externals, std::vector<cc::Alphabet *> alphabets = {}, cc::BitNumbering basisSetNumbering = cc::BitNumbering::LittleEndian);
    6565    std::string makeSignature(const std::unique_ptr<kernel::KernelBuilder> & iBuilder) override;
    6666    bool isCachable() const override { return true; }
     
    7070    std::vector<cc::Alphabet *> mAlphabets;
    7171    cc::BitNumbering mBasisSetNumbering;
    72     bool mFakeBasisBits;
    7372};
    7473
  • icGREP/icgrep-devel/icgrep/kernels/swizzle.cpp

    r6026 r6133  
    77#include <kernels/kernel_builder.h>
    88#include <string>
     9#include <vector>
    910
    1011using namespace llvm;
     
    7980
    8081
     82    SwizzleByGather::SwizzleByGather(const std::unique_ptr<KernelBuilder> &iBuilder)
     83    : BlockOrientedKernel("swizzleByGather", {}, {}, {}, {}, {}){
     84        for (unsigned i = 0; i < 2; i++) {
     85            mStreamSetInputs.push_back(Binding{iBuilder->getStreamSetTy(4, 1), "inputGroup" + std::to_string(i)});
     86        }
     87        for (unsigned i = 0; i < 1; i++) {
     88            mStreamSetOutputs.push_back(Binding{iBuilder->getStreamSetTy(8, 1), "outputGroup" + std::to_string(i), FixedRate(1)});
     89        }
     90    }
     91
     92    void SwizzleByGather::generateDoBlockMethod(const std::unique_ptr<kernel::KernelBuilder> &b) {
     93        Value* outputStreamPtr = b->getOutputStreamBlockPtr("outputGroup0", b->getSize(0));
     94
     95        for (unsigned i = 0; i < 2; i++) {
     96            std::vector<llvm::Value*> inputStream;
     97            Value* inputPtr = b->getInputStreamBlockPtr("inputGroup" + std::to_string(i), b->getSize(0));
     98
     99            Value* inputBytePtr = b->CreatePointerCast(inputPtr, b->getInt8PtrTy());
     100            Function *gatherFunc = Intrinsic::getDeclaration(b->getModule(), Intrinsic::x86_avx2_gather_d_q_256);
     101            Value *addresses = ConstantVector::get(
     102                    {b->getInt32(0), b->getInt32(32), b->getInt32(64), b->getInt32(96)});
     103
     104            for (unsigned j = 0; j < 4; j++) {
     105                Value *gather_result = b->CreateCall(
     106                        gatherFunc,
     107                        {
     108                                UndefValue::get(b->getBitBlockType()),
     109                                inputBytePtr,
     110                                addresses,
     111                                Constant::getAllOnesValue(b->getBitBlockType()),
     112                                b->getInt8(1)
     113                        }
     114                );
     115
     116                inputBytePtr = b->CreateGEP(inputBytePtr, b->getInt32(8));
     117
     118                b->CreateStore(gather_result, outputStreamPtr);
     119                outputStreamPtr = b->CreateGEP(outputStreamPtr, b->getSize(1));
     120            }
     121        }
     122    }
    81123}
  • icGREP/icgrep-devel/icgrep/kernels/swizzle.h

    r6026 r6133  
    6666};
    6767
     68
     69class SwizzleByGather : public BlockOrientedKernel {
     70public:
     71    SwizzleByGather(const std::unique_ptr<kernel::KernelBuilder> & iBuilder);
     72
     73protected:
     74    void generateDoBlockMethod(const std::unique_ptr<kernel::KernelBuilder> & iBuilder) override;
     75private:
     76};
     77
    6878}
    6979   
Note: See TracChangeset for help on using the changeset viewer.