| 49 | } |
| 50 | |
| 51 | Algorithm* 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 |
no test coverage detected