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

Method get_algorithm_heuristic

dnn/src/cuda/batched_matrix_mul/opr_impl.cpp:51–85  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49}
50
51Algorithm* BatchedMatrixMulForwardImpl::get_algorithm_heuristic(
52 const TensorLayout& A, const TensorLayout& B, const TensorLayout& C,
53 size_t workspace_limit_in_bytes, const AlgoAttribute& positive_attr,
54 const AlgoAttribute& negative_attr) {
55 MEGDNN_MARK_USED_VAR(workspace_limit_in_bytes);
56 AlgoBase::SizeArgs args(this, A, B, C);
57 if (sm_algo_pack.cublas.is_available_attribute(
58 args, positive_attr, negative_attr)) {
59 return &sm_algo_pack.cublas;
60 }
61#if CUDA_VERSION >= 10010
62 else if (sm_algo_pack.cublasLt.is_available_attribute(
63 args, positive_attr, negative_attr)) {
64 return &sm_algo_pack.cublasLt;
65 }
66#endif
67 else if (sm_algo_pack.int8x8x32.is_available_attribute(
68 args, positive_attr, negative_attr)) {
69 return &sm_algo_pack.int8x8x32;
70 } else {
71 if (sm_algo_pack.brute_force.is_available_attribute(
72 args, positive_attr, negative_attr)) {
73 return &sm_algo_pack.brute_force;
74 }
75 }
76
77 megdnn_throw(ssprintf(
78 "no batched_matrix_mul algorithm without attribute(%s) with "
79 "attribute(%s) args(%s) and "
80 "workspace limit (%zu bytes)",
81 Algorithm::attribute_str(negative_attr).c_str(),
82 Algorithm::attribute_str(positive_attr).c_str(), args.to_string().c_str(),
83 workspace_limit_in_bytes));
84 return nullptr;
85};
86
87// vim: syntax=cpp.doxygen

Callers 2

execMethod · 0.45

Calls 3

ifFunction · 0.50
to_stringMethod · 0.45

Tested by

no test coverage detected