| 238 | |
| 239 | template<typename T> |
| 240 | kJITHeuristics passesJitHeuristics(span<Node *> root_nodes) { |
| 241 | if (!evalFlag()) { return kJITHeuristics::Pass; } |
| 242 | size_t bytes = 0; |
| 243 | for (Node *n : root_nodes) { |
| 244 | if (n->getHeight() > static_cast<int>(getMaxJitSize())) { |
| 245 | return kJITHeuristics::TreeHeight; |
| 246 | } |
| 247 | // Check if approaching the memory limit |
| 248 | if (getMemoryPressure() >= getMemoryPressureThreshold()) { |
| 249 | NodeIterator<Node> it(n); |
| 250 | NodeIterator<Node> end_node; |
| 251 | bytes = accumulate(it, end_node, bytes, |
| 252 | [=](const size_t prev, const Node &n) { |
| 253 | // getBytes returns the size of the data |
| 254 | // Array. Sub arrays will be represented |
| 255 | // by their parent size. |
| 256 | return prev + n.getBytes(); |
| 257 | }); |
| 258 | } |
| 259 | } |
| 260 | |
| 261 | if (jitTreeExceedsMemoryPressure(bytes)) { |
| 262 | return kJITHeuristics::MemoryPressure; |
| 263 | } |
| 264 | |
| 265 | return kJITHeuristics::Pass; |
| 266 | } |
| 267 | |
| 268 | template<typename T> |
| 269 | Array<T> createNodeArray(const dim4 &dims, Node_ptr node) { |
nothing calls this directly
no test coverage detected