MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / passesJitHeuristics

Function passesJitHeuristics

src/backend/cpu/Array.cpp:240–266  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

238
239template<typename T>
240kJITHeuristics 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
268template<typename T>
269Array<T> createNodeArray(const dim4 &dims, Node_ptr node) {

Callers

nothing calls this directly

Calls 5

getHeightMethod · 0.80
getMemoryPressureFunction · 0.70
getBytesMethod · 0.45

Tested by

no test coverage detected