| 26 | namespace phi { |
| 27 | |
| 28 | const char *AllocationTypeStr(AllocationType type) { |
| 29 | switch (type) { |
| 30 | case AllocationType::UNDEFINED: |
| 31 | return "undefined"; |
| 32 | case AllocationType::CPU: |
| 33 | return "cpu"; |
| 34 | case AllocationType::GPU: |
| 35 | return "gpu"; |
| 36 | case AllocationType::GPUPINNED: |
| 37 | return "gpu_pinned"; |
| 38 | case AllocationType::XPU: |
| 39 | return "xpu"; |
| 40 | case AllocationType::XPUPINNED: |
| 41 | return "xpu_pinned"; |
| 42 | case AllocationType::IPU: |
| 43 | return "ipu"; |
| 44 | case AllocationType::CUSTOM: |
| 45 | return "custom_device"; |
| 46 | default: |
| 47 | PD_THROW("Invalid phi device type."); |
| 48 | return {}; |
| 49 | } |
| 50 | } |
| 51 | |
| 52 | std::ostream &operator<<(std::ostream &os, AllocationType type) { |
| 53 | os << AllocationTypeStr(type); |
no outgoing calls
no test coverage detected