MCPcopy Create free account
hub / github.com/clMathLibraries/clBLAS / checkBestImage

Function checkBestImage

src/library/blas/scimage.c:100–123  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

98}
99
100static void
101checkBestImage(ListNode *node, void *priv)
102{
103 SCImageNode *imgNode;
104 ListNode *dnode;
105 SearchContext *sctx = (SearchContext*)priv;
106 cl_ulong es, is; // extra and image size
107
108 imgNode = container_of(node, node, SCImageNode);
109 is = imgNode->height * imgNode->width;
110 // check if the image is not yet in use and meet the size requirements
111 dnode = listNodeSearch(&imgNode->usingDevices, (const void*)&sctx->devID,
112 deviceNodeCmp);
113 if ((dnode == NULL) && (imgNode->width >= sctx->minWidth)
114 && (is >= sctx->minSize)) {
115 es = (is >= sctx->bestSize) ? (is - sctx->bestSize) :
116 (sctx->bestSize - is);
117 if (es < sctx->minExtraSize) {
118 sctx->minExtraSize = es;
119
120 sctx->bestImgNode = imgNode;
121 }
122 }
123}
124
125int VISIBILITY_HIDDEN
126initSCImages(void)

Callers

nothing calls this directly

Calls 1

listNodeSearchFunction · 0.85

Tested by

no test coverage detected