source: icGREP/icgrep-devel/icgrep/kernels/multiblock_kernel.cpp

Last change on this file was 6296, checked in by cameron, 6 months ago

Merge branch 'master' of https://cs-git-research.cs.surrey.sfu.ca/cameron/parabix-devel

File size: 2.3 KB
Line 
1/*
2 *  Copyright (c) 2018 International Characters.
3 *  This software is licensed to the public under the Open Software License 3.0.
4 */
5#include <kernels/kernel.h>
6
7#include <toolchain/toolchain.h>
8#include <kernels/streamset.h>
9#include <kernels/kernel_builder.h>
10#include <llvm/IR/Constants.h>
11#include <llvm/IR/Function.h>
12#include <llvm/IR/Instructions.h>
13#include <llvm/IR/MDBuilder.h>
14#include <llvm/IR/Module.h>
15#include <llvm/Support/raw_ostream.h>
16#if LLVM_VERSION_INTEGER < LLVM_VERSION_CODE(4, 0, 0)
17#include <llvm/Bitcode/ReaderWriter.h>
18#else
19#include <llvm/Bitcode/BitcodeWriter.h>
20#endif
21#include <llvm/Transforms/Utils/Local.h>
22#include <sstream>
23
24using namespace llvm;
25
26namespace kernel {
27
28using Port = Kernel::Port;
29using StreamPort = Kernel::StreamSetPort;
30using AttrId = Attribute::KindId;
31using RateId = ProcessingRate::KindId;
32using RateValue = ProcessingRate::RateValue;
33
34/** ------------------------------------------------------------------------------------------------------------- *
35 * @brief generateKernelMethod
36 ** ------------------------------------------------------------------------------------------------------------- */
37void MultiBlockKernel::generateKernelMethod(const std::unique_ptr<KernelBuilder> & b) {
38    generateMultiBlockLogic(b, b->CreateSelect(mIsFinal, b->getSize(1), mNumOfStrides));
39}
40
41// MULTI-BLOCK KERNEL CONSTRUCTOR
42MultiBlockKernel::MultiBlockKernel(
43    const std::unique_ptr<KernelBuilder> &b,
44    std::string && kernelName,
45    Bindings && stream_inputs,
46    Bindings && stream_outputs,
47    Bindings && scalar_parameters,
48    Bindings && scalar_outputs,
49    Bindings && internal_scalars)
50: MultiBlockKernel(b,
51    TypeId::MultiBlock,
52    std::move(kernelName),
53    std::move(stream_inputs),
54    std::move(stream_outputs),
55    std::move(scalar_parameters),
56    std::move(scalar_outputs),
57    std::move(internal_scalars)) {
58
59}
60
61MultiBlockKernel::MultiBlockKernel(const std::unique_ptr<KernelBuilder> &b,
62    const TypeId typeId,
63    std::string && kernelName,
64    Bindings && stream_inputs,
65    Bindings && stream_outputs,
66    Bindings && scalar_parameters,
67    Bindings && scalar_outputs,
68    Bindings && internal_scalars)
69: Kernel(b, typeId,
70     std::move(kernelName),
71     std::move(stream_inputs),
72     std::move(stream_outputs),
73     std::move(scalar_parameters),
74     std::move(scalar_outputs),
75     std::move(internal_scalars)) {
76
77}
78
79}
Note: See TracBrowser for help on using the repository browser.