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

Last change on this file since 5184 was 5133, checked in by cameron, 3 years ago

Defer binding of buffers to stream sets until kernel generation

File size: 1.8 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 "streamset.h"
9#include "interface.h"
10#include "kernel.h"
[5002]11
12
13namespace llvm { class Module; class Value;}
14
15namespace IDISA { class IDISA_Builder; }
16
[4981]17//
18// Parallel Prefix Deletion
19// see Parallel Prefix Compress in Henry S. Warren, Hacker's Delight, Chapter 7
20//
21// Given that we want to delete bits within fields of width fw, moving
22// nondeleted bits to the right, the parallel prefix compress method can
23// be applied.   This requires a preprocessing step to compute log2(fw)
24// masks that can be used to select bits to be moved in each step of the
25// algorithm.
26//
27// Deletion Mask Calculation
28
[5002]29std::vector<llvm::Value *> parallel_prefix_deletion_masks(IDISA::IDISA_Builder * iBuilder, unsigned fw, llvm::Value * del_mask);
[4981]30
31// Applying Deletion Masks to a Stream
32
[5002]33llvm::Value * apply_parallel_prefix_deletion(IDISA::IDISA_Builder * iBuilder, unsigned fw, llvm::Value * del_mask, std::vector<llvm::Value *> mv, llvm::Value * strm);
[4981]34
[5071]35using namespace kernel;
[5105]36using namespace parabix;
[4981]37
[5071]38class deletionKernel : public kernel::KernelBuilder {
39public:
[5133]40    deletionKernel(IDISA::IDISA_Builder * iBuilder, unsigned fw, unsigned streamCount) :
[5071]41    KernelBuilder(iBuilder, "del",
[5133]42                  {StreamSetBinding{StreamSetType(streamCount + 2, 1), "inputStreamSet"}},
43                  {StreamSetBinding{StreamSetType(streamCount, 1), "outputStreamSet"},
44                   StreamSetBinding{StreamSetType(1, 1), "deletionCounts"}},
[5071]45                  {}, {}, {}),
46    mDeletionFieldWidth(fw),
[5105]47    mStreamCount(streamCount) {}
[5071]48   
49private:
[5074]50    void generateDoBlockMethod() override;
51    void generateFinalBlockMethod() override;
[5071]52    unsigned mDeletionFieldWidth;
53    unsigned mStreamCount;
54};
55   
[4981]56#endif
57
Note: See TracBrowser for help on using the repository browser.