Skip to content

Commit c2e1294

Browse files
authored
fix running error for ipu (#41481)
1 parent ab137a8 commit c2e1294

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

paddle/phi/common/backend.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ enum class Backend : uint8_t {
5555
// paddle kernel primitives backend
5656
KPS,
5757

58+
IPU,
59+
5860
// end of backend types
5961
NUM_BACKENDS,
6062

@@ -121,6 +123,9 @@ inline std::ostream& operator<<(std::ostream& os, Backend backend) {
121123
case Backend::KPS:
122124
os << "KPS";
123125
break;
126+
case Backend::IPU:
127+
os << "IPU";
128+
break;
124129
default: {
125130
size_t device_type_id_ = static_cast<size_t>(backend) -
126131
static_cast<size_t>(Backend::NUM_BACKENDS);
@@ -155,6 +160,8 @@ inline Backend StringToBackend(const char* backend_cstr) {
155160
return Backend::GPUDNN;
156161
} else if (s == std::string("KPS")) {
157162
return Backend::KPS;
163+
} else if (s == std::string("IPU")) {
164+
return Backend::IPU;
158165
} else {
159166
return static_cast<Backend>(static_cast<size_t>(Backend::NUM_BACKENDS) +
160167
phi::GetOrRegisterGlobalDeviceTypeId(s));

paddle/phi/core/compat/convert_utils.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ Backend TransToPhiBackend(const phi::Place& place) {
3838
return Backend::XPU;
3939
} else if (allocation_type == phi::AllocationType::NPU) {
4040
return Backend::NPU;
41+
} else if (allocation_type == phi::AllocationType::IPU) {
42+
return Backend::IPU;
4143
} else if (allocation_type == phi::AllocationType::CUSTOM) {
4244
return static_cast<Backend>(
4345
static_cast<size_t>(Backend::NUM_BACKENDS) +

0 commit comments

Comments
 (0)