Tensor Comprehensions
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
lut_op.h
Go to the documentation of this file.
1 
16 #pragma once
17 
18 #include <string>
19 #include <vector>
20 
21 #include "tc/c2/tc_op.h"
22 #include "tc/library/lut.h"
23 
24 namespace caffe2 {
25 
26 template <
27  typename T,
28  typename I,
29  class Context,
30  class Engine = caffe2::DefaultEngine>
31 class TcLUTOp : public TcOp<T, Context, Engine> {
32  public:
33  static constexpr auto description = tc::TC_LUT;
34 
35  TcLUTOp(const caffe2::OperatorDef& operator_def, caffe2::Workspace* ws)
36  : TcOp<T, Context, Engine>(operator_def, ws) {
37  this->tc_ = tc::TC_LUT;
38  this->tcName_ = tc::TC_LUT_NAME;
39  }
40 
41  ~TcLUTOp() override {}
42 
43  protected:
44  void setupNaiveMappingOptions() override {
45  this->mappingOptions_.tile({1})
46  .mapToThreads(64)
47  .mapToBlocks(256)
48  .unroll(1)
49  .useSharedMemory(false)
50  .usePrivateMemory(false);
51  }
52 };
53 } // namespace caffe2
tc::MappingOptions mappingOptions_
Definition: tc_op.h:133
MappingOptions & usePrivateMemory(bool b)
Definition: mapping_options-inl.h:331
static constexpr auto description
Definition: lut_op.h:33
MappingOptions & unroll(uint64_t size)
Definition: mapping_options-inl.h:321
MappingOptions & useSharedMemory(bool b)
Definition: mapping_options-inl.h:326
Definition: tc_op.h:36
Definition: lut_op.h:31
MappingOptions & mapToBlocks(std::initializer_list< uint64_t > blocks)
Definition: mapping_options-inl.h:297
std::string tc_
Definition: tc_op.h:128
std::string tcName_
Definition: tc_op.h:130
~TcLUTOp() override
Definition: lut_op.h:41
void setupNaiveMappingOptions() override
Definition: lut_op.h:44
MappingOptions & tile(const std::vector< uint64_t > &sizes)
Definition: mapping_options-inl.h:251
TcLUTOp(const caffe2::OperatorDef &operator_def, caffe2::Workspace *ws)
Definition: lut_op.h:35