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

Last change on this file was 6261, checked in by nmedfort, 7 weeks ago

Work on OptimizationBranch?; revisited pipeline termination

File size: 2.9 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
21    S2PKernel(const std::unique_ptr<kernel::KernelBuilder> &b,
22              StreamSet * const codeUnitStream,
23              StreamSet * const BasisBits,
24              const cc::BitNumbering basisNumbering = cc::BitNumbering::LittleEndian,
25              Scalar * signalNullObject = nullptr);
26
27
28    bool isCachable() const override { return true; }
29    bool hasSignature() const override { return false; }
30protected:
31    Bindings makeOutputBindings(StreamSet * const BasisBits, bool abortOnNull);
32    Bindings makeInputScalarBindings(Scalar * signalNullObject);
33    void generateMultiBlockLogic(const std::unique_ptr<KernelBuilder> & kb, llvm::Value * const numOfStrides) override;
34private:
35    const cc::BitNumbering mBasisSetNumbering;
36    bool mAbortOnNull;
37    unsigned mNumOfStreams;
38};
39
40class S2PMultipleStreamsKernel final : public MultiBlockKernel {
41public:
42    S2PMultipleStreamsKernel(const std::unique_ptr<kernel::KernelBuilder> & b,
43                             StreamSet * codeUnitStream,
44                             const StreamSets & outputStreams,
45                             const cc::BitNumbering basisNumbering = cc::BitNumbering::LittleEndian,
46                             const bool aligned = true);
47protected:
48    void generateMultiBlockLogic(const std::unique_ptr<KernelBuilder> & kb, llvm::Value * const numOfStrides) override;
49private:
50    const cc::BitNumbering mBasisSetNumbering;
51    const bool mAligned;
52};
53
54
55class S2P_21Kernel final : public MultiBlockKernel {
56public:
57    S2P_21Kernel(const std::unique_ptr<kernel::KernelBuilder> &b, StreamSet * const codeUnitStream, StreamSet * const BasisBits, cc::BitNumbering basisNumbering = cc::BitNumbering::LittleEndian);
58    bool isCachable() const override { return true; }
59    bool hasSignature() const override { return false; }
60protected:
61    void generateMultiBlockLogic(const std::unique_ptr<KernelBuilder> & kb, llvm::Value * const numOfStrides) override;
62    const cc::BitNumbering mBasisSetNumbering;
63};
64
65class S2P_PabloKernel final : public pablo::PabloKernel {
66public:
67    S2P_PabloKernel(const std::unique_ptr<KernelBuilder> & b, StreamSet * const codeUnitStream, StreamSet * const BasisBits, cc::BitNumbering basisNumbering = cc::BitNumbering::LittleEndian);
68    bool isCachable() const override { return true; }
69    bool hasSignature() const override { return false; }
70protected:
71    void generatePabloMethod() override;
72private:
73    const cc::BitNumbering  mBasisSetNumbering;
74    const unsigned          mCodeUnitWidth;
75};
76
77
78}
79#endif
Note: See TracBrowser for help on using the repository browser.