Ignore:
Timestamp:
Dec 8, 2017, 1:55:22 AM (22 months ago)
Author:
nmedfort
Message:

Cache signature is now written into .kernel bitcode file. Minor bug fix and revision of GrepEngine::DoGrepThreadMethod?

File:
1 edited

Legend:

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

    r5757 r5761  
    1414    friend class FDSourceKernel;
    1515public:
    16     MMapSourceKernel(const std::unique_ptr<kernel::KernelBuilder> & iBuilder, const unsigned blocksRequiredPerSegment = 1, const unsigned codeUnitWidth = 8);
     16    MMapSourceKernel(const std::unique_ptr<kernel::KernelBuilder> & iBuilder, const unsigned stridesPerSegment = 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, mBlocksRequiredPerSegment, iBuilder);
     23        generateInitializeMethod(mFileSizeFunction, mCodeUnitWidth, mStride * mStridesPerSegment, iBuilder);
    2424    }
    2525    void generateDoSegmentMethod(const std::unique_ptr<kernel::KernelBuilder> & iBuilder) override {
    26         generateDoSegmentMethod(mCodeUnitWidth, mBlocksRequiredPerSegment, iBuilder);
     26        generateDoSegmentMethod(mCodeUnitWidth, mStride * mStridesPerSegment, 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 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);
     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);
    3535    static void unmapSourceBuffer(const std::unique_ptr<kernel::KernelBuilder> & iBuilder);
    3636protected:
    37     const unsigned   mBlocksRequiredPerSegment;
    38     const unsigned   mCodeUnitWidth;
     37    const unsigned mStridesPerSegment;
     38    const unsigned mCodeUnitWidth;
    3939    llvm::Function * mFileSizeFunction;
    4040};
     
    4343    friend class FDSourceKernel;
    4444public:
    45     ReadSourceKernel(const std::unique_ptr<kernel::KernelBuilder> & iBuilder, const unsigned blocksRequiredPerSegment = 1, const unsigned codeUnitWidth = 8);
     45    ReadSourceKernel(const std::unique_ptr<kernel::KernelBuilder> & iBuilder, const unsigned stridesPerSegment = 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, mBlocksRequiredPerSegment, iBuilder);
     49        generateInitializeMethod(mCodeUnitWidth, mStride * mStridesPerSegment, iBuilder);
    5050    }
    5151    void generateDoSegmentMethod(const std::unique_ptr<kernel::KernelBuilder> & iBuilder) override {
    52         generateDoSegmentMethod(mCodeUnitWidth, mBlocksRequiredPerSegment, iBuilder);
     52        generateDoSegmentMethod(mCodeUnitWidth, mStride * mStridesPerSegment, iBuilder);
    5353    }
    5454    void generateFinalizeMethod(const std::unique_ptr<kernel::KernelBuilder> & iBuilder) override {
     
    5656    }
    5757protected:
    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);
     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);
    6060    static void freeBuffer(const std::unique_ptr<kernel::KernelBuilder> & iBuilder);
    6161private:
    62     const unsigned mBlocksRequiredPerSegment;
     62    const unsigned mStridesPerSegment;
    6363    const unsigned mCodeUnitWidth;
    6464};
     
    6666class FDSourceKernel final : public SegmentOrientedKernel {
    6767public:
    68     FDSourceKernel(const std::unique_ptr<kernel::KernelBuilder> & iBuilder, const unsigned blocksRequiredPerSegment = 1, const unsigned codeUnitWidth = 8);
     68    FDSourceKernel(const std::unique_ptr<kernel::KernelBuilder> & iBuilder, const unsigned stridesPerSegment = 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 mBlocksRequiredPerSegment;
     76    const unsigned mStridesPerSegment;
    7777    const unsigned mCodeUnitWidth;
    7878    llvm::Function * mFileSizeFunction;
     
    8181class MemorySourceKernel final : public SegmentOrientedKernel {
    8282public:
    83     MemorySourceKernel(const std::unique_ptr<kernel::KernelBuilder> & iBuilder, llvm::Type * const type, const unsigned blocksRequiredPerSegment = 1, const unsigned codeUnitWidth = 8);
     83    MemorySourceKernel(const std::unique_ptr<kernel::KernelBuilder> & iBuilder, llvm::Type * const type, const unsigned stridesPerSegment = 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     const unsigned mBlocksRequiredPerSegment;
     89    const unsigned mStridesPerSegment;
    9090    const unsigned mCodeUnitWidth;
    9191};
Note: See TracChangeset for help on using the changeset viewer.