source: icGREP/icgrep-devel/icgrep/kernels/s2p_kernel.h @ 6173

Last change on this file since 6173 was 6145, checked in by xwa163, 13 months ago
  1. LZ4 Grep: complete utf8 character classes for multiplexing pipeline
  2. Implement multiple streams version of S2P and P2S
File size: 2.5 KB
Line 
1/*
2 *  Copyright (c) 2018 International Characters.
3 *  This software is licensed to the public under the Open Software License 3.0.
4 */
5#ifndef S2P_KERNEL_H
6#define S2P_KERNEL_H
7
8#include "kernel.h"  // for KernelBuilder
9#include <cc/alphabet.h>
10#include <pablo/pablo_kernel.h>
11#include <string>
12
13namespace IDISA { class IDISA_Builder; }  // lines 14-14
14namespace llvm { class Value; }
15
16namespace kernel {
17
18class S2PKernel final : public MultiBlockKernel {
19public:
20    S2PKernel(const std::unique_ptr<kernel::KernelBuilder> & b, cc::BitNumbering basisNumbering = cc::BitNumbering::LittleEndian, bool aligned = true, std::string prefix = "", unsigned numOfStreams = 8);
21    bool isCachable() const override { return true; }
22    bool hasSignature() const override { return false; }
23protected:
24    void generateMultiBlockLogic(const std::unique_ptr<KernelBuilder> & kb, llvm::Value * const numOfStrides) override;
25private:
26    cc::BitNumbering mBasisSetNumbering;
27    bool mAligned;
28    unsigned mNumOfStreams;
29};
30
31class S2PMultipleStreamsKernel final : public MultiBlockKernel {
32public:
33    S2PMultipleStreamsKernel(const std::unique_ptr<kernel::KernelBuilder> & b, cc::BitNumbering basisNumbering = cc::BitNumbering::LittleEndian, bool aligned = true, std::vector<unsigned> numsOfStreams = std::vector<unsigned>{8});
34protected:
35    void generateMultiBlockLogic(const std::unique_ptr<KernelBuilder> & kb, llvm::Value * const numOfStrides) override;
36private:
37    cc::BitNumbering mBasisSetNumbering;
38    bool mAligned;
39    std::vector<unsigned> mNumsOfStreams;
40};
41
42
43class S2P_21Kernel final : public MultiBlockKernel {
44public:
45    S2P_21Kernel(const std::unique_ptr<kernel::KernelBuilder> & b, cc::BitNumbering basisNumbering = cc::BitNumbering::LittleEndian);
46    bool isCachable() const override { return true; }
47    bool hasSignature() const override { return false; }
48protected:
49    void generateMultiBlockLogic(const std::unique_ptr<KernelBuilder> & kb, llvm::Value * const numOfStrides) override;
50    cc::BitNumbering mBasisSetNumbering;
51};
52
53class S2P_PabloKernel final : public pablo::PabloKernel {
54public:
55    S2P_PabloKernel(const std::unique_ptr<KernelBuilder> & b, unsigned codeUnitWidth = 8, cc::BitNumbering basisNumbering = cc::BitNumbering::LittleEndian);
56    bool isCachable() const override { return true; }
57    bool hasSignature() const override { return false; }
58protected:
59    void generatePabloMethod() override;
60    unsigned mCodeUnitWidth;
61    cc::BitNumbering mBasisSetNumbering;
62};
63
64
65}
66#endif
Note: See TracBrowser for help on using the repository browser.