18 #include "scanner/api/kernel.h" 19 #include "scanner/api/op.h" 20 #include "scanner/util/common.h" 40 KernelFactory(
const std::string& op_name, DeviceType type, i32 max_devices,
41 const std::map<std::string, DeviceType>& input_devices,
42 const std::map<std::string, DeviceType>& output_devices,
43 bool can_batch, i32 batch_size, KernelConstructor constructor)
46 max_devices_(max_devices),
47 input_devices_(input_devices),
48 output_devices_(output_devices),
49 can_batch_(can_batch),
50 preferred_batch_size_(batch_size),
51 constructor_(constructor) {}
53 const std::string& get_op_name()
const {
return op_name_; }
58 i32 get_max_devices()
const {
return max_devices_; }
60 const std::map<std::string, DeviceType>& get_input_devices()
const {
61 return input_devices_;
64 const std::map<std::string, DeviceType>& get_output_devices()
const {
65 return output_devices_;
68 bool can_batch()
const {
return can_batch_; }
70 i32 preferred_batch_size()
const {
return preferred_batch_size_; }
75 return constructor_(config);
82 std::map<std::string, DeviceType> input_devices_;
83 std::map<std::string, DeviceType> output_devices_;
85 i32 preferred_batch_size_;
86 KernelConstructor constructor_;
Kernel parameters provided at instantiation.
Definition: kernel.h:118
Interface for constructing ops at runtime.
Definition: kernel_factory.h:38
DeviceType get_device_type() const
Definition: kernel_factory.h:56
Definition: database.cpp:36
Interface for a unit of computation in a pipeline.
Definition: kernel.h:145