This function determines if consecutive cast operations should be removed from a JIT AST. This function returns true if consecutive cast operations in the JIT AST should be removed. Multiple cast operations are removed when going from a smaller type to a larger type and back again OR if the conversion is between two floating point types including complex types. Cast operations that will be remov
| 53 | /// |
| 54 | /// \returns True if the inner cast operation should be removed |
| 55 | constexpr bool canOptimizeCast(af::dtype outer, af::dtype inner) { |
| 56 | if (isFloating(outer)) { |
| 57 | if (isFloating(inner)) { return true; } |
| 58 | } else { |
| 59 | if (isFloating(inner)) { return true; } |
| 60 | if (dtypeSize(inner) >= dtypeSize(outer)) { return true; } |
| 61 | } |
| 62 | |
| 63 | return false; |
| 64 | } |
| 65 | |
| 66 | #ifdef AF_CPU |
| 67 | template<typename To, typename Ti> |
no test coverage detected