Ignore:
Timestamp:
Feb 2, 2018, 2:49:08 PM (15 months ago)
Author:
nmedfort
Message:

Revised pipeline structure to better control I/O rates

File:
1 edited

Legend:

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

    r5761 r5856  
    1414    friend class FDSourceKernel;
    1515public:
    16     MMapSourceKernel(const std::unique_ptr<kernel::KernelBuilder> & iBuilder, const unsigned stridesPerSegment = 1, const unsigned codeUnitWidth = 8);
     16    MMapSourceKernel(const std::unique_ptr<kernel::KernelBuilder> & iBuilder, const unsigned codeUnitWidth = 8);
    1717    bool isCachable() const override { return true; }
    1818    bool hasSignature() const override { return false; }
     
    2121    }
    2222    void generateInitializeMethod(const std::unique_ptr<kernel::KernelBuilder> & iBuilder) override {
    23         generateInitializeMethod(mFileSizeFunction, mCodeUnitWidth, mStride * mStridesPerSegment, iBuilder);
     23        generateInitializeMethod(mFileSizeFunction, mCodeUnitWidth, iBuilder);
    2424    }
    2525    void generateDoSegmentMethod(const std::unique_ptr<kernel::KernelBuilder> & iBuilder) override {
    26         generateDoSegmentMethod(mCodeUnitWidth, mStride * mStridesPerSegment, iBuilder);
     26        generateDoSegmentMethod(mCodeUnitWidth, iBuilder);
    2727    }
    2828    void generateFinalizeMethod(const std::unique_ptr<kernel::KernelBuilder> & iBuilder) override {
     
    3131protected:
    3232    static llvm::Function * linkFileSizeMethod(const std::unique_ptr<kernel::KernelBuilder> & iBuilder);
    33     static void generateInitializeMethod(llvm::Function * fileSize, const unsigned codeUnitWidth, const unsigned segmentSize, const std::unique_ptr<kernel::KernelBuilder> & iBuilder);
    34     static void generateDoSegmentMethod(const unsigned codeUnitWidth, const unsigned segmentSize, 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 std::unique_ptr<kernel::KernelBuilder> & iBuilder);
    3535    static void unmapSourceBuffer(const std::unique_ptr<kernel::KernelBuilder> & iBuilder);
    3636protected:
    37     const unsigned mStridesPerSegment;
    3837    const unsigned mCodeUnitWidth;
    3938    llvm::Function * mFileSizeFunction;
     
    4342    friend class FDSourceKernel;
    4443public:
    45     ReadSourceKernel(const std::unique_ptr<kernel::KernelBuilder> & iBuilder, const unsigned stridesPerSegment = 1, const unsigned codeUnitWidth = 8);
     44    ReadSourceKernel(const std::unique_ptr<kernel::KernelBuilder> & iBuilder, const unsigned codeUnitWidth = 8);
    4645    bool isCachable() const override { return true; }
    4746    bool hasSignature() const override { return false; }
    4847    void generateInitializeMethod(const std::unique_ptr<kernel::KernelBuilder> & iBuilder) override {
    49         generateInitializeMethod(mCodeUnitWidth, mStride * mStridesPerSegment, iBuilder);
     48        generateInitializeMethod(mCodeUnitWidth, getStride(), iBuilder);
    5049    }
    5150    void generateDoSegmentMethod(const std::unique_ptr<kernel::KernelBuilder> & iBuilder) override {
    52         generateDoSegmentMethod(mCodeUnitWidth, mStride * mStridesPerSegment, iBuilder);
     51        generateDoSegmentMethod(mCodeUnitWidth, getStride(), iBuilder);
    5352    }
    5453    void generateFinalizeMethod(const std::unique_ptr<kernel::KernelBuilder> & iBuilder) override {
     
    5655    }
    5756protected:
    58     static void generateInitializeMethod(const unsigned codeUnitWidth, const unsigned segmentSize, const std::unique_ptr<kernel::KernelBuilder> & iBuilder);
    59     static void generateDoSegmentMethod(const unsigned codeUnitWidth, const unsigned segmentSize, const std::unique_ptr<kernel::KernelBuilder> & iBuilder);
     57    static void generateInitializeMethod(const unsigned codeUnitWidth, const unsigned stride, const std::unique_ptr<kernel::KernelBuilder> & iBuilder);
     58    static void generateDoSegmentMethod(const unsigned codeUnitWidth, const unsigned stride, const std::unique_ptr<kernel::KernelBuilder> & iBuilder);
    6059    static void freeBuffer(const std::unique_ptr<kernel::KernelBuilder> & iBuilder);
    6160private:
    62     const unsigned mStridesPerSegment;
    6361    const unsigned mCodeUnitWidth;
    6462};
     
    6664class FDSourceKernel final : public SegmentOrientedKernel {
    6765public:
    68     FDSourceKernel(const std::unique_ptr<kernel::KernelBuilder> & iBuilder, const unsigned stridesPerSegment = 1, const unsigned codeUnitWidth = 8);
     66    FDSourceKernel(const std::unique_ptr<kernel::KernelBuilder> & iBuilder, const unsigned codeUnitWidth = 8);
    6967    bool isCachable() const override { return true; }
    7068    bool hasSignature() const override { return false; }
     
    7472    void generateFinalizeMethod(const std::unique_ptr<kernel::KernelBuilder> & iBuilder) override;
    7573protected:
    76     const unsigned mStridesPerSegment;
    7774    const unsigned mCodeUnitWidth;
    7875    llvm::Function * mFileSizeFunction;
     
    8178class MemorySourceKernel final : public SegmentOrientedKernel {
    8279public:
    83     MemorySourceKernel(const std::unique_ptr<kernel::KernelBuilder> & iBuilder, llvm::Type * const type, const unsigned stridesPerSegment = 1, const unsigned codeUnitWidth = 8);
     80    MemorySourceKernel(const std::unique_ptr<kernel::KernelBuilder> & iBuilder, llvm::Type * const type, const unsigned codeUnitWidth = 8);
    8481    bool hasSignature() const override { return false; }
    8582protected:
     
    8784    void generateDoSegmentMethod(const std::unique_ptr<kernel::KernelBuilder> & iBuilder) override;
    8885private:
    89     const unsigned mStridesPerSegment;
    9086    const unsigned mCodeUnitWidth;
    9187};
Note: See TracChangeset for help on using the changeset viewer.