Ignore:
Timestamp:
Dec 6, 2017, 5:41:27 PM (22 months ago)
Author:
nmedfort
Message:

Bug fixes + more assertions to prevent similar errors.

File:
1 edited

Legend:

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

    r5706 r5757  
    1414    friend class FDSourceKernel;
    1515public:
    16     MMapSourceKernel(const std::unique_ptr<kernel::KernelBuilder> & iBuilder, unsigned blocksPerSegment = 1, unsigned codeUnitWidth = 8);
     16    MMapSourceKernel(const std::unique_ptr<kernel::KernelBuilder> & iBuilder, const unsigned blocksRequiredPerSegment = 1, 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, iBuilder);
     23        generateInitializeMethod(mFileSizeFunction, mCodeUnitWidth, mBlocksRequiredPerSegment, iBuilder);
    2424    }
    2525    void generateDoSegmentMethod(const std::unique_ptr<kernel::KernelBuilder> & iBuilder) override {
    26         generateDoSegmentMethod(mCodeUnitWidth, mSegmentBlocks, iBuilder);
     26        generateDoSegmentMethod(mCodeUnitWidth, mBlocksRequiredPerSegment, 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 std::unique_ptr<kernel::KernelBuilder> & iBuilder);
    34     static void generateDoSegmentMethod(const unsigned codeUnitWidth, const unsigned segmentBlocks, const std::unique_ptr<kernel::KernelBuilder> & iBuilder);
     33    static void generateInitializeMethod(llvm::Function * fileSize, const unsigned codeUnitWidth, const unsigned blocksRequiredPerSegment, const std::unique_ptr<kernel::KernelBuilder> & iBuilder);
     34    static void generateDoSegmentMethod(const unsigned codeUnitWidth, const unsigned blocksRequiredPerSegment, const std::unique_ptr<kernel::KernelBuilder> & iBuilder);
    3535    static void unmapSourceBuffer(const std::unique_ptr<kernel::KernelBuilder> & iBuilder);
    3636protected:
    37     const unsigned          mSegmentBlocks;
    38     const unsigned          mCodeUnitWidth;
    39     llvm::Function *        mFileSizeFunction;
     37    const unsigned   mBlocksRequiredPerSegment;
     38    const unsigned   mCodeUnitWidth;
     39    llvm::Function * mFileSizeFunction;
    4040};
    4141
     
    4343    friend class FDSourceKernel;
    4444public:
    45     ReadSourceKernel(const std::unique_ptr<kernel::KernelBuilder> & iBuilder, unsigned blocksPerSegment = 1, unsigned codeUnitWidth = 8);
     45    ReadSourceKernel(const std::unique_ptr<kernel::KernelBuilder> & iBuilder, const unsigned blocksRequiredPerSegment = 1, const unsigned codeUnitWidth = 8);
    4646    bool isCachable() const override { return true; }
    4747    bool hasSignature() const override { return false; }
    4848    void generateInitializeMethod(const std::unique_ptr<kernel::KernelBuilder> & iBuilder) override {
    49         generateInitializeMethod(mCodeUnitWidth, iBuilder);
     49        generateInitializeMethod(mCodeUnitWidth, mBlocksRequiredPerSegment, iBuilder);
    5050    }
    5151    void generateDoSegmentMethod(const std::unique_ptr<kernel::KernelBuilder> & iBuilder) override {
    52         generateDoSegmentMethod(mCodeUnitWidth, mSegmentBlocks, iBuilder);
     52        generateDoSegmentMethod(mCodeUnitWidth, mBlocksRequiredPerSegment, iBuilder);
    5353    }
    5454    void generateFinalizeMethod(const std::unique_ptr<kernel::KernelBuilder> & iBuilder) override {
     
    5656    }
    5757protected:
    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);
     58    static void generateInitializeMethod(const unsigned codeUnitWidth, const unsigned blocksRequiredPerSegment, const std::unique_ptr<kernel::KernelBuilder> & iBuilder);
     59    static void generateDoSegmentMethod(const unsigned codeUnitWidth, const unsigned blocksRequiredPerSegment, const std::unique_ptr<kernel::KernelBuilder> & iBuilder);
    6060    static void freeBuffer(const std::unique_ptr<kernel::KernelBuilder> & iBuilder);
    6161private:
    62     unsigned mSegmentBlocks;
    63     unsigned mCodeUnitWidth;
     62    const unsigned mBlocksRequiredPerSegment;
     63    const unsigned mCodeUnitWidth;
    6464};
    6565
    6666class FDSourceKernel final : public SegmentOrientedKernel {
    6767public:
    68     FDSourceKernel(const std::unique_ptr<kernel::KernelBuilder> & iBuilder, unsigned blocksPerSegment = 1, unsigned codeUnitWidth = 8);
     68    FDSourceKernel(const std::unique_ptr<kernel::KernelBuilder> & iBuilder, const unsigned blocksRequiredPerSegment = 1, const unsigned codeUnitWidth = 8);
    6969    bool isCachable() const override { return true; }
    7070    bool hasSignature() const override { return false; }
     
    7474    void generateFinalizeMethod(const std::unique_ptr<kernel::KernelBuilder> & iBuilder) override;
    7575protected:
    76     const unsigned          mSegmentBlocks;
    77     const unsigned          mCodeUnitWidth;
    78     llvm::Function *        mFileSizeFunction;
     76    const unsigned mBlocksRequiredPerSegment;
     77    const unsigned mCodeUnitWidth;
     78    llvm::Function * mFileSizeFunction;
    7979};
    8080   
    8181class MemorySourceKernel final : public SegmentOrientedKernel {
    8282public:
    83     MemorySourceKernel(const std::unique_ptr<kernel::KernelBuilder> & iBuilder, llvm::Type * type, unsigned blocksPerSegment = 1, unsigned codeUnitWidth = 8);
     83    MemorySourceKernel(const std::unique_ptr<kernel::KernelBuilder> & iBuilder, llvm::Type * const type, const unsigned blocksRequiredPerSegment = 1, const unsigned codeUnitWidth = 8);
    8484    bool hasSignature() const override { return false; }
    8585protected:
     
    8787    void generateDoSegmentMethod(const std::unique_ptr<kernel::KernelBuilder> & iBuilder) override;
    8888private:
    89     unsigned mSegmentBlocks;
    90     unsigned mCodeUnitWidth;
     89    const unsigned mBlocksRequiredPerSegment;
     90    const unsigned mCodeUnitWidth;
    9191};
    9292
Note: See TracChangeset for help on using the changeset viewer.