LLVM: include/llvm/Analysis/MLModelRunner.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10#ifndef LLVM_ANALYSIS_MLMODELRUNNER_H

11#define LLVM_ANALYSIS_MLMODELRUNNER_H

12

15

16namespace llvm {

18

19

20

21

22

23

24

25

27public:

28

32

36

37 template <typename T, typename I> T *getTensor(I FeatureID) {

38 return reinterpret_cast<T *>(

40 }

41

42 template <typename T, typename I> const T *getTensor(I FeatureID) const {

43 return reinterpret_cast<const T *>(

45 }

46

49 return (const_cast<MLModelRunner *>(this))->getTensorUntyped(Index);

50 }

51

55

56protected:

62

64 void *Buffer) {

65 if (!Buffer) {

66 OwnedBuffers.emplace_back(Spec.getTotalTensorBufferSize());

67 Buffer = OwnedBuffers.back().data();

68 }

69 InputBuffers[Index] = Buffer;

70 }

71

74

75private:

76 std::vector<void *> InputBuffers;

77 std::vector<std::vector<char *>> OwnedBuffers;

78};

79}

80

81#endif

assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")

This header defines various interfaces for pass management in LLVM.

This is an important class for using LLVM in a threaded context.

Kind getKind() const

Definition MLModelRunner.h:53

const T * getTensor(I FeatureID) const

Definition MLModelRunner.h:42

virtual void * evaluateUntyped()=0

virtual void switchContext(StringRef Name)

Definition MLModelRunner.h:54

void * getTensorUntyped(size_t Index)

Definition MLModelRunner.h:47

T * getTensor(I FeatureID)

Definition MLModelRunner.h:37

T evaluate()

Definition MLModelRunner.h:33

Kind

Definition MLModelRunner.h:52

@ Interactive

Definition MLModelRunner.h:52

@ Development

Definition MLModelRunner.h:52

@ NoOp

Definition MLModelRunner.h:52

@ Unknown

Definition MLModelRunner.h:52

@ Release

Definition MLModelRunner.h:52

void setUpBufferForTensor(size_t Index, const TensorSpec &Spec, void *Buffer)

Definition MLModelRunner.h:63

const void * getTensorUntyped(size_t Index) const

Definition MLModelRunner.h:48

const Kind Type

Definition MLModelRunner.h:73

virtual ~MLModelRunner()=default

MLModelRunner(LLVMContext &Ctx, Kind Type, size_t NumInputs)

Definition MLModelRunner.h:57

MLModelRunner(const MLModelRunner &)=delete

MLModelRunner & operator=(const MLModelRunner &)=delete

LLVMContext & Ctx

Definition MLModelRunner.h:72

StringRef - Represent a constant reference to a string, i.e.

This is an optimization pass for GlobalISel generic memory operations.