You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

akg_kernel_metadata.cc 1.8 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /**
  2. * Copyright 2020 Huawei Technologies Co., Ltd
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #include "kernel/akg/akg_kernel_metadata.h"
  17. #include <memory>
  18. #include "session/anf_runtime_algorithm.h"
  19. #include "kernel/oplib/oplib.h"
  20. #include "kernel/common_utils.h"
  21. namespace mindspore {
  22. namespace kernel {
  23. void AkgMetadataInfo(const CNodePtr &kernel_node,
  24. std::vector<std::shared_ptr<KernelBuildInfo>> *const kernel_info_list) {
  25. MS_EXCEPTION_IF_NULL(kernel_node);
  26. MS_EXCEPTION_IF_NULL(kernel_info_list);
  27. std::string op_name = AnfAlgo::GetCNodeName(kernel_node);
  28. for (size_t i = 0; i < support_devices.size(); i++) {
  29. auto op_info_ptr = mindspore::kernel::OpLib::FindOp(op_name, OpImplyType::kAKG);
  30. if (op_info_ptr == nullptr) {
  31. continue;
  32. }
  33. if (!ParseMetadata(kernel_node, op_info_ptr, Processor(i), kernel_info_list)) {
  34. MS_LOG(WARNING) << "Akg parsed metadata of op[" << op_name << "], device[" << support_devices[i] << "] failed.";
  35. } else {
  36. MS_LOG(DEBUG) << "Akg parsed metadata of op[" << op_name << "], device[" << support_devices[i] << "].";
  37. break;
  38. }
  39. }
  40. if (kernel_info_list->empty()) {
  41. MS_LOG(WARNING) << "Akg dose not has metadata of op[" << op_name << "].";
  42. }
  43. }
  44. } // namespace kernel
  45. } // namespace mindspore