source: icGREP/icgrep-devel/icgrep/kernels/deletion.h @ 5404

Last change on this file since 5404 was 5392, checked in by cameron, 2 years ago

Kernel signatures for object cache

File size: 2.5 KB
RevLine 
[4981]1/*
2 *  Copyright (c) 2016 International Characters.
3 *  This software is licensed to the public under the Open Software License 3.0.
4 */
5#ifndef DELETION_H
6#define DELETION_H
7
[5071]8#include "kernel.h"
[5362]9#include <llvm/IR/Value.h>
[5002]10namespace IDISA { class IDISA_Builder; }
11
[4981]12//
13// Parallel Prefix Deletion
14// see Parallel Prefix Compress in Henry S. Warren, Hacker's Delight, Chapter 7
15//
16// Given that we want to delete bits within fields of width fw, moving
17// nondeleted bits to the right, the parallel prefix compress method can
18// be applied.   This requires a preprocessing step to compute log2(fw)
19// masks that can be used to select bits to be moved in each step of the
20// algorithm.
21//
22
[5202]23namespace kernel {
24
[5283]25class DeletionKernel : public BlockOrientedKernel {
[5071]26public:
[5260]27
28    DeletionKernel(IDISA::IDISA_Builder * iBuilder, unsigned fw, unsigned streamCount);
[5392]29    bool moduleIDisSignature() override {return true;}
30
[5260]31protected:
[5297]32    void generateDoBlockMethod() override;
[5260]33
[5297]34    void generateFinalBlockMethod(llvm::Value * remainingBytes) override;
[5260]35
36private:
[5267]37    const unsigned mDeletionFieldWidth;
38    const unsigned mStreamCount;
[5071]39};
[5202]40
[5313]41class DeleteByPEXTkernel : public BlockOrientedKernel {
42public:
[5362]43
44    DeleteByPEXTkernel(IDISA::IDISA_Builder * iBuilder, unsigned fw, unsigned streamCount, bool shouldSwizzle);
[5392]45    bool moduleIDisSignature() override {return true;}
[5313]46   
47protected:
48    void generateDoBlockMethod() override;
49   
50    void generateFinalBlockMethod(llvm::Value * remainingBytes) override;
[5362]51
52    void generatePEXTAndSwizzleLoop(const std::vector<llvm::Value *> & masks);
53
54    void generatePEXTLoop(const std::vector<llvm::Value *> & masks);
55
56    void generateProcessingLoop(const std::vector<llvm::Value *> & masks, llvm::Value * delMask);
[5313]57   
58private:
59    const unsigned mDelCountFieldWidth;
60    const unsigned mStreamCount;
[5362]61    const unsigned mSwizzleFactor;
62    const bool mShouldSwizzle;
63    static constexpr const char* mOutputSwizzleNameBase = "outputStreamSet";
[5313]64};
[5355]65   
66class SwizzledBitstreamCompressByCount : public BlockOrientedKernel {
67public:
68   
69    SwizzledBitstreamCompressByCount(IDISA::IDISA_Builder * iBuilder, unsigned bitStreamCount, unsigned fieldWidth = 64);
[5392]70    bool moduleIDisSignature() override {return true;}
[5355]71   
72protected:
[5392]73    void generateDoBlockMethod() override;
[5355]74   
75    void generateFinalBlockMethod(llvm::Value * remainingBytes) override;
76   
77private:
78    const unsigned mBitStreamCount;
79    const unsigned mFieldWidth;
80    const unsigned mSwizzleFactor;
81    const unsigned mSwizzleSetCount;
82};
83
84   
[5202]85}
[5071]86   
[4981]87#endif
88
Note: See TracBrowser for help on using the repository browser.