| 56 | |
| 57 | template <class F> |
| 58 | migraphx_status |
| 59 | try_(F f, bool output = true, source_location llc = source_location::current()) // NOLINT |
| 60 | { |
| 61 | #ifdef MIGRAPHX_BUILD_TESTING |
| 62 | if(disable_exception_catch) |
| 63 | { |
| 64 | f(); |
| 65 | } |
| 66 | else |
| 67 | { |
| 68 | #endif |
| 69 | try |
| 70 | { |
| 71 | f(); |
| 72 | } |
| 73 | catch(const migraphx::exception& ex) |
| 74 | { |
| 75 | if(output) |
| 76 | std::cerr << llc.function_name() << ": Error: " << ex.what() << std::endl; |
| 77 | if(ex.error > 0) |
| 78 | return migraphx_status(ex.error); |
| 79 | else |
| 80 | return migraphx_status_unknown_error; |
| 81 | } |
| 82 | catch(const std::exception& ex) |
| 83 | { |
| 84 | if(output) |
| 85 | std::cerr << llc.function_name() << ": Error: " << ex.what() << std::endl; |
| 86 | return migraphx_status_unknown_error; |
| 87 | } |
| 88 | catch(...) |
| 89 | { |
| 90 | return migraphx_status_unknown_error; |
| 91 | } |
| 92 | #ifdef MIGRAPHX_BUILD_TESTING |
| 93 | } |
| 94 | #endif |
| 95 | return migraphx_status_success; |
| 96 | } |
| 97 | |
| 98 | static shape::type_t to_shape_type(migraphx_shape_datatype_t t) |
| 99 | { |
| 100 | switch(t) |
| 101 | { |
| 102 | case migraphx_shape_tuple_type: return shape::tuple_type; |
| 103 | case migraphx_shape_fp4x2_type: return shape::fp4x2_type; |
| 104 | #define MIGRAPHX_DETAIL_SHAPE_CASE_CONVERT(x, y) \ |
| 105 | case migraphx_shape_##x: return shape::x; |
| 106 | MIGRAPHX_SHAPE_VISIT_TYPES(MIGRAPHX_DETAIL_SHAPE_CASE_CONVERT) |
| 107 | #undef MIGRAPHX_DETAIL_SHAPE_CASE_CONVERT |
| 108 | } |
| 109 | MIGRAPHX_THROW(migraphx_status_bad_param, "Unknown type"); |
| 110 | } |
| 111 | |
| 112 | static migraphx_shape_datatype_t to_shape_type(shape::type_t t) |
| 113 | { |
| 114 | switch(t) |
| 115 | { |
no test coverage detected