| 187 | } |
| 188 | |
| 189 | static bool IsMegamorphic( |
| 190 | int64 compile_count, |
| 191 | int64 execution_count, |
| 192 | uint64 max_compile_time_s) { |
| 193 | const int64 kCompileThreshold = 10; |
| 194 | const int64 kMinExecutionsPerCompile = 50; |
| 195 | const uint64 kMaxCompileTimeThreshold = 30; |
| 196 | |
| 197 | // This heuristic is trying to capture the following property: have we sunk a |
| 198 | // certain minimum amount of compile time into the cluster that didn't quite |
| 199 | // "pay off"? |
| 200 | return (compile_count > kCompileThreshold && |
| 201 | execution_count < kMinExecutionsPerCompile * compile_count) || |
| 202 | max_compile_time_s > kMaxCompileTimeThreshold; |
| 203 | } |
| 204 | |
| 205 | Status XlaCompilationCache::CompileSingleOp( |
| 206 | const XlaCompiler::Options& options, |