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

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

Refactored source kernels. icgrep from stdin should now be able to handle any file size.

File size: 1.8 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(IDISA::IDISA_Builder * iBuilder, unsigned blocksPerSegment = 1, unsigned codeUnitWidth = 8);
16    bool moduleIDisSignature() final { return true; }
17protected:
18    void linkExternalMethods() override;
19    void generateInitializeMethod() override;
20    void generateDoSegmentMethod() override;
21    void generateFinalizeMethod() override;
22protected:
23    const unsigned          mSegmentBlocks;
24    const unsigned          mCodeUnitWidth;
25    llvm::Function *        mFileSizeFunction;
26};
27
28class ReadSourceKernel final : public SegmentOrientedKernel {
29public:
30    ReadSourceKernel(IDISA::IDISA_Builder * iBuilder, unsigned blocksPerSegment = 1, unsigned codeUnitWidth = 8);
31    bool moduleIDisSignature() override { return true; }
32protected:
33    void generateInitializeMethod() override;
34    void generateDoSegmentMethod() override;
35    void generateFinalizeMethod() override;
36private:
37    unsigned mSegmentBlocks;
38    unsigned mCodeUnitWidth;
39};
40
41class MemorySourceKernel final : public SegmentOrientedKernel {
42public:
43    MemorySourceKernel(IDISA::IDISA_Builder * iBuilder, llvm::Type * type, unsigned blocksPerSegment = 1, unsigned codeUnitWidth = 8);
44    bool moduleIDisSignature() override { return true; }
45protected:
46    void generateInitializeMethod() override;
47    void generateDoSegmentMethod() override;
48private:
49    unsigned mSegmentBlocks;
50    unsigned mCodeUnitWidth;
51};
52
53}
54
55#endif // SOURCE_KERNEL_H
Note: See TracBrowser for help on using the repository browser.