MCPcopy Create free account
hub / github.com/PaddlePaddle/Paddle / KernelTypeParser

Class KernelTypeParser

paddle/phi/api/lib/kernel_dispatch.h:161–181  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

159};
160
161struct KernelTypeParser : ArgsIterator<KernelTypeParser> {
162 KernelType kernel_type{KernelType::DENSE_TENSOR_KERNEL};
163
164 // TODO(chenweihang): deal with multiple diff input Tensors
165 // TODO(chenweihang): add global device guard method to set backend
166 void operator()(const Tensor& x) {
167 if (phi::SelectedRows::classof(x.impl().get())) {
168 kernel_type = KernelType::SELECTED_ROWS_KERNEL;
169 } else if (phi::SparseCooTensor::classof(x.impl().get())) {
170 kernel_type = KernelType::SPARSE_COO_KERNEL;
171 } else if (phi::SparseCsrTensor::classof(x.impl().get())) {
172 kernel_type = KernelType::SPARSE_CSR_KERNEL;
173 }
174 }
175
176 // skip other type args, these args don't used in kernel selection
177 template <typename T>
178 void operator()(const T& x) {
179 // do nothing
180 }
181};
182
183/* ------------------ for auto parallel ----------------------- */
184

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected