Ignore:
Timestamp:
Oct 25, 2017, 4:57:58 PM (20 months ago)
Author:
nmedfort
Message:

First stage of MultiBlockKernel? and pipeline restructuring

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/kernels/source_kernel.h

    r5693 r5706  
    1212
    1313class MMapSourceKernel final : public SegmentOrientedKernel {
     14    friend class FDSourceKernel;
    1415public:
    1516    MMapSourceKernel(const std::unique_ptr<kernel::KernelBuilder> & iBuilder, unsigned blocksPerSegment = 1, unsigned codeUnitWidth = 8);
    1617    bool isCachable() const override { return true; }
    1718    bool hasSignature() const override { return false; }
    18     void linkExternalMethods(const std::unique_ptr<kernel::KernelBuilder> & iBuilder) override;
    19     void generateInitializeMethod(const std::unique_ptr<kernel::KernelBuilder> & iBuilder) override;
    20     void generateDoSegmentMethod(const std::unique_ptr<kernel::KernelBuilder> & iBuilder) override;
    21     void generateFinalizeMethod(const std::unique_ptr<kernel::KernelBuilder> & iBuilder) override;
     19    void linkExternalMethods(const std::unique_ptr<kernel::KernelBuilder> & iBuilder) override {
     20        mFileSizeFunction = linkFileSizeMethod(iBuilder);
     21    }
     22    void generateInitializeMethod(const std::unique_ptr<kernel::KernelBuilder> & iBuilder) override {
     23        generateInitializeMethod(mFileSizeFunction, mCodeUnitWidth, iBuilder);
     24    }
     25    void generateDoSegmentMethod(const std::unique_ptr<kernel::KernelBuilder> & iBuilder) override {
     26        generateDoSegmentMethod(mCodeUnitWidth, mSegmentBlocks, iBuilder);
     27    }
     28    void generateFinalizeMethod(const std::unique_ptr<kernel::KernelBuilder> & iBuilder) override {
     29        unmapSourceBuffer(iBuilder);
     30    }
     31protected:
     32    static llvm::Function * linkFileSizeMethod(const std::unique_ptr<kernel::KernelBuilder> & iBuilder);
     33    static void generateInitializeMethod(llvm::Function * fileSize, const unsigned codeUnitWidth, const std::unique_ptr<kernel::KernelBuilder> & iBuilder);
     34    static void generateDoSegmentMethod(const unsigned codeUnitWidth, const unsigned segmentBlocks, const std::unique_ptr<kernel::KernelBuilder> & iBuilder);
     35    static void unmapSourceBuffer(const std::unique_ptr<kernel::KernelBuilder> & iBuilder);
    2236protected:
    2337    const unsigned          mSegmentBlocks;
     
    2741
    2842class ReadSourceKernel final : public SegmentOrientedKernel {
     43    friend class FDSourceKernel;
    2944public:
    3045    ReadSourceKernel(const std::unique_ptr<kernel::KernelBuilder> & iBuilder, unsigned blocksPerSegment = 1, unsigned codeUnitWidth = 8);
    3146    bool isCachable() const override { return true; }
    3247    bool hasSignature() const override { return false; }
    33     void generateInitializeMethod(const std::unique_ptr<kernel::KernelBuilder> & iBuilder) override;
    34     void generateDoSegmentMethod(const std::unique_ptr<kernel::KernelBuilder> & iBuilder) override;
    35     void generateFinalizeMethod(const std::unique_ptr<kernel::KernelBuilder> & iBuilder) override;
     48    void generateInitializeMethod(const std::unique_ptr<kernel::KernelBuilder> & iBuilder) override {
     49        generateInitializeMethod(mCodeUnitWidth, iBuilder);
     50    }
     51    void generateDoSegmentMethod(const std::unique_ptr<kernel::KernelBuilder> & iBuilder) override {
     52        generateDoSegmentMethod(mCodeUnitWidth, mSegmentBlocks, iBuilder);
     53    }
     54    void generateFinalizeMethod(const std::unique_ptr<kernel::KernelBuilder> & iBuilder) override {
     55        freeBuffer(iBuilder);
     56    }
     57protected:
     58    static void generateInitializeMethod(const unsigned codeUnitWidth, const std::unique_ptr<kernel::KernelBuilder> & iBuilder);
     59    static void generateDoSegmentMethod(const unsigned codeUnitWidth, const unsigned segmentBlocks, const std::unique_ptr<kernel::KernelBuilder> & iBuilder);
     60    static void freeBuffer(const std::unique_ptr<kernel::KernelBuilder> & iBuilder);
    3661private:
    3762    unsigned mSegmentBlocks;
Note: See TracChangeset for help on using the changeset viewer.