Enzyme main
Loading...
Searching...
No Matches
PreserveNVVM.h
Go to the documentation of this file.
1//===- PreserveNVVM.h - Mark NVVM attributes for preservation. -------===//
2//
3// Enzyme Project
4//
5// Part of the Enzyme Project, under the Apache License v2.0 with LLVM
6// Exceptions. See https://llvm.org/LICENSE.txt for license information.
7// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
8//
9// If using this code in an academic setting, please cite the following:
10// @incollection{enzymeNeurips,
11// title = {Instead of Rewriting Foreign Code for Machine Learning,
12// Automatically Synthesize Fast Gradients},
13// author = {Moses, William S. and Churavy, Valentin},
14// booktitle = {Advances in Neural Information Processing Systems 33},
15// year = {2020},
16// note = {To appear in},
17// }
18//
19//===----------------------------------------------------------------------===//
20//
21// This file contains createPreserveNVVM, a transformation pass that marks
22// calls to __nv_* functions, marking them as noinline as implementing the llvm
23// intrinsic.
24//
25//===----------------------------------------------------------------------===//
26
27#ifndef ENZYME_PRESERVE_NVVM_H
28#define ENZYME_PRESERVE_NVVM_H
29
30#include "PassUtils.h"
31#include "llvm/IR/PassManager.h"
32
33namespace llvm {
34class ModulePass;
35class FunctionPass;
36} // namespace llvm
37
38llvm::ModulePass *createPreserveNVVMPass(bool Begin);
39llvm::FunctionPass *createPreserveNVVMFnPass(bool Begin);
40
41class PreserveNVVMNewPM final : public PassParent<PreserveNVVMNewPM> {
43
44private:
45 bool Begin;
46 static llvm::AnalysisKey Key;
47
48public:
49 using Result = llvm::PreservedAnalyses;
50 PreserveNVVMNewPM(bool Begin) : Begin(Begin) {}
51
52 Result run(llvm::Module &M, llvm::ModuleAnalysisManager &MAM);
53
54 static bool isRequired() { return true; }
55};
56
57#endif // ENZYME_PRESERVE_NVVM_H
llvm::ModulePass * createPreserveNVVMPass(bool Begin)
llvm::FunctionPass * createPreserveNVVMFnPass(bool Begin)
PreserveNVVMNewPM(bool Begin)
llvm::PreservedAnalyses Result
Result run(llvm::Module &M, llvm::ModuleAnalysisManager &MAM)
static bool isRequired()