MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / get_algorithm_heuristic

Method get_algorithm_heuristic

dnn/src/cambricon/convolution/opr_impl.cpp:38–54  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36}
37
38ConvolutionForwardImpl::Algorithm* ConvolutionForwardImpl::get_algorithm_heuristic(
39 const TensorLayout& src, const TensorLayout& filter, const TensorLayout& dst,
40 size_t workspace_limit_in_bytes, const AlgoAttribute& positive_attr,
41 const AlgoAttribute& negative_attr) {
42 auto fm = check_layout_fwd(src, filter, dst);
43 AlgoBase::SizeArgs args{this, src, filter, fm, dst};
44 auto&& all_algos = algo_pack().all_algos;
45 for (auto algo : all_algos) {
46 if (algo->get_workspace_in_bytes(args) <= workspace_limit_in_bytes &&
47 algo->is_available(args))
48 return algo;
49 }
50 megdnn_assert(
51 false, "No Suitable algo with src->{%s}, filter->{%s}\n",
52 src.to_string().c_str(), filter.to_string().c_str());
53 return nullptr;
54}
55
56size_t ConvolutionForwardImpl::get_workspace_in_bytes(
57 const TensorLayout& src, const TensorLayout& filter, const TensorLayout& dst,

Callers

nothing calls this directly

Calls 3

is_availableMethod · 0.45
to_stringMethod · 0.45

Tested by

no test coverage detected