Yang Ni | a4ded13 | 2014-11-17 17:44:08 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2013, The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #ifndef BCC_RS_SCRIPT_GROUP_FUSION_H |
| 18 | #define BCC_RS_SCRIPT_GROUP_FUSION_H |
| 19 | |
| 20 | #include <vector> |
Yang Ni | 0ab50b8 | 2015-02-16 12:31:56 -0800 | [diff] [blame] | 21 | #include <string> |
Yang Ni | a4ded13 | 2014-11-17 17:44:08 -0800 | [diff] [blame] | 22 | |
| 23 | namespace llvm { |
| 24 | class Module; |
| 25 | } |
| 26 | |
| 27 | namespace bcc { |
| 28 | |
| 29 | class Source; |
Yang Ni | a4ded13 | 2014-11-17 17:44:08 -0800 | [diff] [blame] | 30 | class BCCContext; |
| 31 | |
| 32 | /// @brief Fuse kernels |
| 33 | /// |
Yang Ni | 0ab50b8 | 2015-02-16 12:31:56 -0800 | [diff] [blame] | 34 | /// @param Context bcc context. |
| 35 | /// @param sources The Sources containing the kernels. |
| 36 | /// @param slots The slots where the kernels are located. |
| 37 | /// @param fusedName |
Yang Ni | 8c12d61 | 2015-06-19 16:02:38 -0700 | [diff] [blame] | 38 | /// @return True, if kernels are successfully fused. False, otherwise. It's up to |
| 39 | /// the caller on how to deal with unsuccessful fusion. A script group can |
| 40 | /// execute with either fused kernels or individual kernels. |
Yang Ni | 0ab50b8 | 2015-02-16 12:31:56 -0800 | [diff] [blame] | 41 | bool fuseKernels(BCCContext& Context, |
| 42 | const std::vector<Source *>& sources, |
| 43 | const std::vector<int>& slots, |
| 44 | const std::string& fusedName, |
| 45 | llvm::Module* mergedModule); |
| 46 | |
| 47 | bool renameInvoke(BCCContext& Context, const Source* source, const int slot, |
| 48 | const std::string& newName, llvm::Module* mergedModule); |
Yang Ni | a4ded13 | 2014-11-17 17:44:08 -0800 | [diff] [blame] | 49 | } |
| 50 | |
| 51 | #endif /* BCC_RS_SCRIPT_GROUP_FUSION_H */ |