enforce_xpu.h 1.5 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
/* Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */

#pragma once

#include "paddle/fluid/platform/device/xpu/xpu_header.h"
W
Wilber 已提交
18 19

#include "paddle/pten/backends/xpu/enforce_xpu.h"
20 21 22 23 24 25

namespace paddle {
namespace platform {

// Note: XPU runtime api return int, not XPUError_t
inline const char* xpuGetErrorString(int stat) {
W
Wilber 已提交
26
  return pten::backends::xpu::xpuGetErrorString(stat);
27 28 29
}

inline const char* bkclGetErrorString(BKCLResult_t stat) {
W
Wilber 已提交
30
  return pten::backends::xpu::bkclGetErrorString(stat);
31 32
}

33
inline const char* xdnnGetErrorString(int stat) {
W
Wilber 已提交
34
  return pten::backends::xpu::xdnnGetErrorString(stat);
35 36
}

37
inline std::string build_xpu_error_msg(int stat) {
W
Wilber 已提交
38
  return pten::backends::xpu::build_xpu_error_msg(stat);
39 40 41
}

inline std::string build_xpu_error_msg(BKCLResult_t stat) {
W
Wilber 已提交
42
  return pten::backends::xpu::build_xpu_error_msg(stat);
43 44
}

45
inline std::string build_xpu_xdnn_error_msg(int stat, std::string msg) {
W
Wilber 已提交
46
  return pten::backends::xpu::build_xpu_xdnn_error_msg(stat, msg);
47 48
}

49 50
}  // namespace platform
}  // namespace paddle