source: icGREP/icgrep-devel/icgrep/kernels/source_kernel.h @ 5435

Last change on this file since 5435 was 5435, checked in by nmedfort, 2 years ago

Continued refactoring work.

File size: 1.9 KB
Line 
1#ifndef SOURCE_KERNEL_H
2#define SOURCE_KERNEL_H
3
4#include "kernel.h"
5namespace IDISA { class IDISA_Builder; }
6
7namespace kernel {
8
9/* The MMapSourceKernel is a simple wrapper for an external MMap file buffer.
10   The doSegment method of this kernel feeds one segment at a time to a
11   pipeline. */
12
13class MMapSourceKernel final : public SegmentOrientedKernel {
14public:
15    MMapSourceKernel(const std::unique_ptr<IDISA::IDISA_Builder> & iBuilder, unsigned blocksPerSegment = 1, unsigned codeUnitWidth = 8);
16    bool isCachable() const override { return true; }
17    bool moduleIDisSignature() const override { return true; }
18protected:
19    void linkExternalMethods() override;
20    void generateInitializeMethod() override;
21    void generateDoSegmentMethod() override;
22    void generateFinalizeMethod() override;
23protected:
24    const unsigned          mSegmentBlocks;
25    const unsigned          mCodeUnitWidth;
26    llvm::Function *        mFileSizeFunction;
27};
28
29class ReadSourceKernel final : public SegmentOrientedKernel {
30public:
31    ReadSourceKernel(const std::unique_ptr<IDISA::IDISA_Builder> & iBuilder, unsigned blocksPerSegment = 1, unsigned codeUnitWidth = 8);
32    bool isCachable() const override { return true; }
33    bool moduleIDisSignature() const override { return true; }
34protected:
35    void generateInitializeMethod() override;
36    void generateDoSegmentMethod() override;
37    void generateFinalizeMethod() override;
38private:
39    unsigned mSegmentBlocks;
40    unsigned mCodeUnitWidth;
41};
42
43class MemorySourceKernel final : public SegmentOrientedKernel {
44public:
45    MemorySourceKernel(const std::unique_ptr<IDISA::IDISA_Builder> & iBuilder, llvm::Type * type, unsigned blocksPerSegment = 1, unsigned codeUnitWidth = 8);
46    bool moduleIDisSignature() const override { return true; }
47protected:
48    void generateInitializeMethod() override;
49    void generateDoSegmentMethod() override;
50private:
51    unsigned mSegmentBlocks;
52    unsigned mCodeUnitWidth;
53};
54
55}
56
57#endif // SOURCE_KERNEL_H
Note: See TracBrowser for help on using the repository browser.