source: icGREP/icgrep-devel/icgrep/IDISA/idisa_nvptx_builder.h @ 5217

Last change on this file since 5217 was 5217, checked in by nmedfort, 3 years ago

Merged PabloFunction? and PabloKernel? classes. Updated projects where necessary.

File size: 2.3 KB
Line 
1#ifndef IDISA_NVPTX_BUILDER_H
2#define IDISA_NVPTX_BUILDER_H
3
4/*
5 *  Copyright (c) 2015 International Characters.
6 *  This software is licensed to the public under the Open Software License 3.0.
7*/
8
9#include <IDISA/idisa_builder.h>
10#include <IDISA/idisa_i64_builder.h>
11#include <iostream>
12using namespace llvm;
13
14namespace IDISA {
15
16class IDISA_NVPTX20_Builder : public IDISA_I64_Builder {
17public:
18   
19    IDISA_NVPTX20_Builder(Module * m, unsigned groupSize)
20    : IDISA_I64_Builder(m, 64, 64, 64 * groupSize)
21    , groupThreads(groupSize) {
22        CreateGlobals();
23        CreateBuiltinFunctions();
24        CreateLongAdvanceFunc();
25        CreateLongAddFunc();
26        CreateBallotFunc();
27    }
28   
29    ~IDISA_NVPTX20_Builder() {}
30
31    int getGroupThreads();
32   
33    Value * bitblock_any(Value * a) override;
34    std::pair<Value *, Value *> bitblock_add_with_carry(Value * a, Value * b, Value * carryin) override;
35    virtual std::pair<Value *, Value *> bitblock_advance(Value * a, Value * shiftin, unsigned shift) override;
36    Value * bitblock_mask_from(Value * pos) override;
37    Value * bitblock_set_bit(Value * pos) override;
38
39    Value * getEOFMask(Value * remainingBytes);
40
41    Value * Advance(const unsigned index, const unsigned shiftAmount, Value * const value);
42    Value * LongAdd(Value * const valA, Value * const valB, Value * carryIn);
43
44    LoadInst * CreateAtomicLoadAcquire(Value * ptr) override;
45    StoreInst * CreateAtomicStoreRelease(Value * val, Value * ptr) override; 
46
47private:
48    void CreateGlobals();
49    void CreateBuiltinFunctions();
50    void CreateLongAdvanceFunc();
51    void CreateLongAddFunc();
52    void CreateBallotFunc();
53
54    int                                 groupThreads;
55    Function *                          barrierFunc;
56    Function *                          tidFunc;
57    Function *                          mLongAdvanceFunc;
58    Function *                          mLongAddFunc;
59    GlobalVariable*                     carry;
60    GlobalVariable*                     bubble;
61};
62
63#if 0
64
65class IDISA_NVPTX35_Builder : public IDISA_NVPTX20_Builder {
66    IDISA_NVPTX35_Builder(Module * m, int groupSize) : IDISA_NVPTX30_Builder(m, groupSize) {}
67   
68    std::pair<Value *, Value *> bitblock_advance(Value * a, Value * shiftin, unsigned shift) override;
69
70    ~IDISA_NVPTX35_Builder() {};
71
72};
73#endif   
74   
75}
76#endif // IDISA_NVPTX_BUILDER_H
Note: See TracBrowser for help on using the repository browser.