Branch data Line data Source code
1 : : /* SPDX-License-Identifier: BSD-3-Clause
2 : : * Copyright (c) 2022 Marvell.
3 : : */
4 : :
5 : : #include <rte_mldev_pmd.h>
6 : :
7 : : #include <roc_api.h>
8 : :
9 : : #include "cn10k_ml_ocm.h"
10 : :
11 : : #include "cnxk_ml_dev.h"
12 : : #include "cnxk_ml_model.h"
13 : :
14 : : /* OCM macros */
15 : : #define BYTE_LEN 8
16 : : #define OCM_MAP_WORD_SIZE (sizeof(uint8_t) * BYTE_LEN)
17 : : #define IS_BIT_SET(num, n) ((num) & (1 << (n)))
18 : : #define SET_BIT(num, n) ((num) | (1 << (n)))
19 : : #define CLEAR_BIT(num, n) ((num) &= ~((1) << (n)))
20 : :
21 : : /* Left shift multi-word mask by 1 bit.
22 : : *
23 : : * For example, given a mask of two uint8_t words
24 : : * Input: [00110101] [00110111]
25 : : * Output: [01101010] [01101110]
26 : : */
27 : : static void
28 : : lshift_mask(uint8_t *mask, int nwords)
29 : : {
30 : : int i;
31 : : int word_sz;
32 : :
33 : : word_sz = sizeof(uint8_t) * BYTE_LEN;
34 [ # # # # : 0 : for (i = nwords - 1; i >= 0; i--) {
# # ]
35 : 0 : mask[i] = mask[i] << 1;
36 [ # # # # : 0 : if (i != 0)
# # ]
37 : 0 : mask[i] = mask[i] | (mask[i - 1] >> (word_sz - 1));
38 : : }
39 : : }
40 : :
41 : : /* Get the index of the first unused slot in a multi-word mask (base_mask). Unused slots only after
42 : : * the start_pos are considered. An unused slot is a sequence of slot_sz continuous unset bits in
43 : : * the multi-word mask. For example given a multi-word mask,
44 : : *
45 : : * The program creates a search_mask with slot_sz bits set. Uses a sliding windows approach to scan
46 : : * the mask to identify the available first slot. search_mask slides left from start_pos to end.
47 : : *
48 : : * [10111000] [01001001]
49 : : * - WORD 1 --- WORD 0 -
50 : : *
51 : : * When start = 0,
52 : : * Index of the first unused slot of size 4 is 7.
53 : : * Index of the first unused slot of size 3 is 7.
54 : : * Index of the first unused slot of size 2 is 1.
55 : : * Index of the first unused slot of size 1 is 1.
56 : : *
57 : : * When start = 2,
58 : : * Index of the first unused slot of size 4 is 7.
59 : : * Index of the first unused slot of size 2 is 4.
60 : : * Index of the first unused slot of size 1 is 2.
61 : : *
62 : : * When unable to find a valid slot, return 0
63 : : * When slot_sz is zero, return max_idx + 1
64 : : */
65 : : static int
66 : 0 : slot_index_lowest(uint8_t *base_mask, int nwords, int slot_sz, int start_pos)
67 : : {
68 : : uint8_t *search_mask;
69 : : int word_sz;
70 : : int end_pos;
71 : : int min_idx;
72 : : int max_idx;
73 : : bool match;
74 : : int i, j;
75 : : int idx;
76 : :
77 : : word_sz = sizeof(uint8_t) * BYTE_LEN;
78 : : min_idx = 0;
79 : 0 : max_idx = word_sz * nwords;
80 : : idx = min_idx - 1;
81 : :
82 [ # # ]: 0 : if (slot_sz == 0)
83 : : return max_idx;
84 : :
85 : : /* Create a mask with slot_sz bits set */
86 : 0 : search_mask = plt_zmalloc(nwords * sizeof(uint8_t), 0);
87 [ # # ]: 0 : if (search_mask == NULL)
88 : 0 : goto error;
89 : :
90 [ # # ]: 0 : for (i = 0; i < nwords; i++) {
91 [ # # ]: 0 : if (i < slot_sz / word_sz)
92 : 0 : search_mask[i] = 0xFF;
93 [ # # ]: 0 : else if (i > slot_sz / word_sz)
94 : 0 : search_mask[i] = 0x00;
95 : : else
96 : 0 : search_mask[i] = (1 << (slot_sz % word_sz)) - 1;
97 : : }
98 : :
99 : : /* Shift search mask by start_pos bits */
100 [ # # ]: 0 : for (i = 0; i < start_pos; i++)
101 : : lshift_mask(search_mask, nwords);
102 : :
103 : : /* Scan for a slot, left shift search mask after every iteration */
104 : 0 : end_pos = nwords * word_sz - slot_sz + 1;
105 [ # # ]: 0 : for (j = start_pos; j < end_pos; j++) {
106 : : match = true;
107 [ # # ]: 0 : for (i = 0; i < nwords; i++)
108 [ # # # # ]: 0 : match = match && (((~base_mask[i]) & search_mask[i]) == search_mask[i]);
109 : :
110 [ # # ]: 0 : if (match) {
111 : : idx = j;
112 : 0 : goto found;
113 : : }
114 : :
115 : : lshift_mask(search_mask, nwords);
116 : : }
117 : :
118 : 0 : found:
119 : 0 : plt_free(search_mask);
120 : :
121 : : error:
122 : : return idx;
123 : : }
124 : :
125 : : /* Find the largest possible unused slot, with a minimum size of search_sz in a multi-work mask. The
126 : : * function returns the start index of the slot and the size of the identified slot (slot_sz).
127 : : *
128 : : * For example, in multi-word mask
129 : : *
130 : : * [10111000] [01001001]
131 : : * - WORD 1 --- WORD 0 -
132 : : *
133 : : * When search_sz > 4, return value = -1, slot_sz = 0
134 : : * When search_sz <=4, return value = 7, slot_sz = 4
135 : : */
136 : : static int
137 : 0 : slot_index_largest(uint8_t *base_mask, int nwords, int search_sz, int *slot_sz)
138 : : {
139 : : uint8_t *search_mask;
140 : : int mask_sz;
141 : : int word_sz;
142 : : int end_pos;
143 : : bool match;
144 : : int i, j;
145 : : int idx;
146 : :
147 : : word_sz = sizeof(uint8_t) * BYTE_LEN;
148 : 0 : mask_sz = nwords * word_sz;
149 : : idx = -1;
150 : :
151 : : /* Create a mask with mask_sz bits set */
152 : 0 : search_mask = plt_zmalloc(mask_sz, 0);
153 [ # # ]: 0 : if (search_mask == NULL)
154 : 0 : goto error;
155 : :
156 : 0 : start:
157 [ # # ]: 0 : for (i = 0; i < nwords; i++) {
158 [ # # ]: 0 : if (i < mask_sz / word_sz)
159 : 0 : search_mask[i] = 0xFF;
160 [ # # ]: 0 : else if (i > mask_sz / word_sz)
161 : 0 : search_mask[i] = 0x00;
162 : : else
163 : 0 : search_mask[i] = (1 << (mask_sz % word_sz)) - 1;
164 : : }
165 : :
166 : : /* Scan for a slot, left shift search mask after every iteration */
167 : 0 : end_pos = nwords * word_sz - mask_sz + 1;
168 [ # # ]: 0 : for (j = 0; j < end_pos; j++) {
169 : : match = true;
170 [ # # ]: 0 : for (i = 0; i < nwords; i++)
171 [ # # # # ]: 0 : match = match && (((~base_mask[i]) & search_mask[i]) == search_mask[i]);
172 : :
173 [ # # ]: 0 : if (match) {
174 : : idx = j;
175 : 0 : goto found;
176 : : }
177 : : lshift_mask(search_mask, nwords);
178 : : }
179 : :
180 : 0 : mask_sz--;
181 [ # # ]: 0 : if (mask_sz >= search_sz)
182 : 0 : goto start;
183 : : else
184 : : mask_sz = 0;
185 : :
186 : 0 : found:
187 : 0 : plt_free(search_mask);
188 [ # # ]: 0 : if (search_sz == 0)
189 : : idx = word_sz * nwords;
190 : :
191 : 0 : error:
192 [ # # ]: 0 : if (slot_sz)
193 : 0 : *slot_sz = mask_sz;
194 : :
195 : 0 : return idx;
196 : : }
197 : :
198 : : /* Count number of bits in a tilemask. Assumes that all set bits are contiguous. */
199 : : int
200 : 0 : cn10k_ml_ocm_tilecount(uint64_t tilemask, int *start, int *end)
201 : : {
202 : : uint8_t count;
203 : :
204 : : PLT_ASSERT(tilemask != 0);
205 : :
206 : 0 : *start = __builtin_ctzl(tilemask);
207 : 0 : *end = 64 - __builtin_clzl(tilemask) - 1;
208 : 0 : count = *end - *start + 1;
209 : :
210 : : PLT_ASSERT(count == __builtin_popcountl(tilemask));
211 : 0 : return count;
212 : : }
213 : :
214 : : /* Find the tiles and wb_page_start to load the model on given 'num_tiles' tiles with the specified
215 : : * scratch & WB pages and OCM allocation mode.
216 : : */
217 : : int
218 : 0 : cn10k_ml_ocm_tilemask_find(struct cnxk_ml_dev *cnxk_mldev, uint8_t num_tiles, uint16_t wb_pages,
219 : : uint16_t scratch_pages, uint64_t *tilemask)
220 : : {
221 : : struct cn10k_ml_dev *cn10k_mldev;
222 : : struct cn10k_ml_ocm *ocm;
223 : :
224 : : uint16_t used_scratch_pages_max;
225 : : uint16_t scratch_page_start;
226 : : int used_last_wb_page_max;
227 : : uint16_t scratch_page_end;
228 : : uint8_t search_end_tile;
229 : : uint8_t *local_ocm_mask;
230 : : int wb_page_start_curr;
231 : : int max_slot_sz_curr;
232 : : uint8_t tile_start;
233 : : int wb_page_start;
234 : : uint16_t tile_id;
235 : : uint16_t word_id;
236 : : uint8_t tile_idx;
237 : : int max_slot_sz;
238 : : int page_id;
239 : :
240 : : cn10k_mldev = &cnxk_mldev->cn10k_mldev;
241 : : ocm = &cn10k_mldev->ocm;
242 : :
243 [ # # ]: 0 : if (num_tiles > ML_CN10K_OCM_NUMTILES) {
244 : 0 : plt_err("Invalid num_tiles = %u (> %u)", num_tiles, ML_CN10K_OCM_NUMTILES);
245 : 0 : return -1;
246 : : }
247 : :
248 : : memset(tilemask, 0, sizeof(uint64_t));
249 : : wb_page_start = -1;
250 : : used_scratch_pages_max = 0;
251 : : used_last_wb_page_max = -1;
252 : 0 : max_slot_sz_curr = 0;
253 : : max_slot_sz = 0;
254 : : tile_idx = 0;
255 : : tile_start = 0;
256 : 0 : search_end_tile = ocm->num_tiles - num_tiles;
257 : :
258 : : /* Allocate for local ocm mask */
259 : 0 : local_ocm_mask = rte_zmalloc("local_ocm_mask", ocm->mask_words, RTE_CACHE_LINE_SIZE);
260 [ # # ]: 0 : if (local_ocm_mask == NULL) {
261 : 0 : plt_err("Unable to allocate memory for local_ocm_mask");
262 : 0 : return -1;
263 : : }
264 : :
265 : 0 : start_search:
266 : : used_scratch_pages_max = 0;
267 : : used_last_wb_page_max = -1;
268 [ # # ]: 0 : for (tile_id = tile_start; tile_id < tile_start + num_tiles; tile_id++) {
269 : : used_scratch_pages_max =
270 : 0 : PLT_MAX(ocm->tile_ocm_info[tile_id].scratch_pages, used_scratch_pages_max);
271 : : used_last_wb_page_max =
272 : 0 : PLT_MAX(ocm->tile_ocm_info[tile_id].last_wb_page, used_last_wb_page_max);
273 : : }
274 : :
275 : 0 : memset(local_ocm_mask, 0, ocm->mask_words);
276 [ # # ]: 0 : for (tile_id = tile_start; tile_id < tile_start + num_tiles; tile_id++) {
277 [ # # ]: 0 : for (word_id = 0; word_id < ocm->mask_words; word_id++)
278 : 0 : local_ocm_mask[word_id] |= ocm->tile_ocm_info[tile_id].ocm_mask[word_id];
279 : : }
280 : :
281 [ # # ]: 0 : if (used_scratch_pages_max < scratch_pages) { /* Check for extra scratch pages */
282 [ # # ]: 0 : if (ocm->num_pages - used_last_wb_page_max - 1 >=
283 : : scratch_pages) { /* Pages available */
284 : 0 : scratch_page_start = ocm->num_pages - scratch_pages;
285 : 0 : scratch_page_end = ocm->num_pages - 1;
286 [ # # ]: 0 : for (page_id = scratch_page_start; page_id <= scratch_page_end;
287 : 0 : page_id++) { /* Mark the extra scratch pages as used */
288 : 0 : local_ocm_mask[page_id / OCM_MAP_WORD_SIZE] =
289 : 0 : SET_BIT(local_ocm_mask[page_id / OCM_MAP_WORD_SIZE],
290 : : page_id % OCM_MAP_WORD_SIZE);
291 : : }
292 : : } else { /* Pages not available, check for next set of tiles */
293 : 0 : goto next_search;
294 : : }
295 : : }
296 : :
297 [ # # ]: 0 : if (strcmp(ocm->alloc_mode, "lowest") == 0) {
298 : 0 : wb_page_start = slot_index_lowest(local_ocm_mask, ocm->mask_words, wb_pages, 0);
299 [ # # ]: 0 : if (wb_page_start != -1) { /* Have a valid slot for WB, else next set of tiles */
300 : : tile_idx = tile_start;
301 : 0 : goto found;
302 : : }
303 [ # # ]: 0 : } else if (strcmp(ocm->alloc_mode, "largest") == 0) {
304 : 0 : wb_page_start_curr = slot_index_largest(local_ocm_mask, ocm->mask_words, wb_pages,
305 : : &max_slot_sz_curr);
306 [ # # ]: 0 : if (max_slot_sz_curr > max_slot_sz) {
307 : : wb_page_start = wb_page_start_curr;
308 : : max_slot_sz = max_slot_sz_curr;
309 : : tile_idx = tile_start;
310 [ # # ]: 0 : } else if (max_slot_sz_curr == max_slot_sz) {
311 : : wb_page_start = wb_page_start_curr;
312 [ # # ]: 0 : if (wb_page_start == ocm->num_pages) {
313 : : tile_idx = tile_start;
314 : 0 : goto found;
315 : : }
316 : : }
317 : : }
318 : :
319 : 0 : next_search:
320 : 0 : tile_start = tile_start + num_tiles;
321 [ # # ]: 0 : if (tile_start <= search_end_tile)
322 : 0 : goto start_search;
323 : :
324 : 0 : found:
325 [ # # ]: 0 : if (wb_page_start != -1)
326 : 0 : *tilemask = GENMASK_ULL(tile_idx + num_tiles - 1, tile_idx);
327 : :
328 : 0 : rte_free(local_ocm_mask);
329 : :
330 : 0 : return wb_page_start;
331 : : }
332 : :
333 : : void
334 : 0 : cn10k_ml_ocm_reserve_pages(struct cnxk_ml_dev *cnxk_mldev, uint16_t model_id, uint16_t layer_id,
335 : : uint64_t tilemask, int wb_page_start, uint16_t wb_pages,
336 : : uint16_t scratch_pages)
337 : : {
338 : : struct cnxk_ml_model *model;
339 : : struct cnxk_ml_layer *layer;
340 : : struct cn10k_ml_ocm *ocm;
341 : :
342 : : int scratch_page_start;
343 : : int scratch_page_end;
344 : : int wb_page_end;
345 : : int tile_start;
346 : : int tile_end;
347 : : int tile_id;
348 : : int page_id;
349 : :
350 : : ocm = &cnxk_mldev->cn10k_mldev.ocm;
351 : 0 : model = cnxk_mldev->mldev->data->models[model_id];
352 : 0 : layer = &model->layer[layer_id];
353 : :
354 : : /* Get first set bit, tile_start */
355 : 0 : tile_start = 0;
356 : 0 : tile_end = 0;
357 : 0 : cn10k_ml_ocm_tilecount(tilemask, &tile_start, &tile_end);
358 : 0 : wb_page_end = wb_page_start + wb_pages - 1;
359 : 0 : scratch_page_start = ocm->num_pages - scratch_pages;
360 : 0 : scratch_page_end = ocm->num_pages - 1;
361 : :
362 : : /* Update tile_ocm_info */
363 [ # # ]: 0 : for (tile_id = tile_start; tile_id <= tile_end; tile_id++) {
364 : : /* Scratch pages */
365 [ # # ]: 0 : for (page_id = scratch_page_start; page_id <= scratch_page_end; page_id++)
366 : 0 : ocm->tile_ocm_info[tile_id].ocm_mask[page_id / OCM_MAP_WORD_SIZE] = SET_BIT(
367 : : ocm->tile_ocm_info[tile_id].ocm_mask[page_id / OCM_MAP_WORD_SIZE],
368 : : page_id % OCM_MAP_WORD_SIZE);
369 : 0 : ocm->tile_ocm_info[tile_id].scratch_pages =
370 : 0 : PLT_MAX(ocm->tile_ocm_info[tile_id].scratch_pages, scratch_pages);
371 : :
372 : : /* WB pages */
373 [ # # ]: 0 : for (page_id = wb_page_start; page_id <= wb_page_end; page_id++)
374 : 0 : ocm->tile_ocm_info[tile_id].ocm_mask[page_id / OCM_MAP_WORD_SIZE] = SET_BIT(
375 : : ocm->tile_ocm_info[tile_id].ocm_mask[page_id / OCM_MAP_WORD_SIZE],
376 : : page_id % OCM_MAP_WORD_SIZE);
377 [ # # ]: 0 : if (wb_pages != 0)
378 : 0 : ocm->tile_ocm_info[tile_id].last_wb_page =
379 : 0 : PLT_MAX(ocm->tile_ocm_info[tile_id].last_wb_page, wb_page_end);
380 : : }
381 : :
382 : 0 : layer->glow.addr.tile_start = tile_start;
383 : 0 : layer->glow.addr.tile_end = tile_end;
384 : :
385 : 0 : plt_ml_dbg("model_id = %u, tilemask = 0x%016lx", model_id, tilemask);
386 : 0 : plt_ml_dbg("model_id = %u, wb_page_start = %d, wb_page_end = %d", model_id, wb_page_start,
387 : : wb_page_end);
388 : 0 : plt_ml_dbg("model_id = %u, scratch_page_start = %d, scratch_page_end = %d", model_id,
389 : : scratch_page_start, scratch_page_end);
390 : 0 : }
391 : :
392 : : void
393 : 0 : cn10k_ml_ocm_free_pages(struct cnxk_ml_dev *cnxk_mldev, uint16_t model_id, uint16_t layer_id)
394 : : {
395 : : struct cnxk_ml_model *local_model;
396 : : struct cnxk_ml_layer *local_layer;
397 : : struct cnxk_ml_model *model;
398 : : struct cnxk_ml_layer *layer;
399 : : struct cn10k_ml_ocm *ocm;
400 : :
401 : : int scratch_resize_pages;
402 : : int wb_page_start;
403 : : int wb_page_end;
404 : : int prev_start;
405 : : int curr_start;
406 : : int tile_id;
407 : : int page_id;
408 : : uint16_t i;
409 : : uint16_t j;
410 : :
411 : : ocm = &cnxk_mldev->cn10k_mldev.ocm;
412 : 0 : model = cnxk_mldev->mldev->data->models[model_id];
413 : 0 : layer = &model->layer[layer_id];
414 : :
415 : : /* Update OCM info for WB memory */
416 : 0 : wb_page_start = layer->glow.ocm_map.wb_page_start;
417 : 0 : wb_page_end = wb_page_start + layer->glow.ocm_map.wb_pages - 1;
418 [ # # ]: 0 : for (tile_id = layer->glow.addr.tile_start; tile_id <= layer->glow.addr.tile_end;
419 : 0 : tile_id++) {
420 [ # # ]: 0 : for (page_id = wb_page_start; page_id <= wb_page_end; page_id++) {
421 : 0 : CLEAR_BIT(ocm->tile_ocm_info[tile_id].ocm_mask[page_id / OCM_MAP_WORD_SIZE],
422 : : page_id % OCM_MAP_WORD_SIZE);
423 : : }
424 : :
425 : : /* Update last_wb_page size */
426 [ # # ]: 0 : if (wb_page_end == ocm->tile_ocm_info[tile_id].last_wb_page)
427 : 0 : ocm->tile_ocm_info[tile_id].last_wb_page = wb_page_start - 1;
428 : :
429 : : /* Get max scratch pages required, excluding the current model */
430 : : scratch_resize_pages = 0;
431 [ # # ]: 0 : for (i = 0; i < cnxk_mldev->mldev->data->nb_models; i++) {
432 : 0 : local_model = cnxk_mldev->mldev->data->models[i];
433 [ # # ]: 0 : if (local_model == NULL)
434 : 0 : continue;
435 : :
436 [ # # ]: 0 : for (j = 0; j < local_model->nb_layers; j++) {
437 : 0 : local_layer = &local_model->layer[j];
438 [ # # ]: 0 : if (local_layer->type != ML_CNXK_LAYER_TYPE_MRVL)
439 : 0 : continue;
440 : :
441 [ # # ]: 0 : if (local_layer != layer &&
442 [ # # ]: 0 : local_layer->glow.ocm_map.ocm_reserved) {
443 [ # # ]: 0 : if (IS_BIT_SET(local_layer->glow.ocm_map.tilemask, tile_id))
444 : : scratch_resize_pages =
445 : 0 : PLT_MAX((int)local_layer->glow.ocm_map
446 : : .scratch_pages,
447 : : scratch_resize_pages);
448 : : }
449 : : }
450 : : }
451 : :
452 : : /* Clear extra scratch pages */
453 [ # # ]: 0 : if (scratch_resize_pages < ocm->tile_ocm_info[tile_id].scratch_pages) {
454 : 0 : prev_start = ocm->num_pages - ocm->tile_ocm_info[tile_id].scratch_pages;
455 : 0 : curr_start = ocm->num_pages - scratch_resize_pages;
456 [ # # ]: 0 : for (page_id = prev_start; page_id < curr_start; page_id++) {
457 : 0 : CLEAR_BIT(ocm->tile_ocm_info[tile_id]
458 : : .ocm_mask[page_id / OCM_MAP_WORD_SIZE],
459 : : page_id % OCM_MAP_WORD_SIZE);
460 : : }
461 : 0 : ocm->tile_ocm_info[tile_id].scratch_pages = scratch_resize_pages;
462 : : }
463 : : }
464 : 0 : }
465 : :
466 : : static void
467 : 0 : cn10k_ml_ocm_pagemask_to_str(struct cn10k_ml_ocm_tile_info *tile_info, uint16_t nwords, char *str)
468 : : {
469 : : char *p = str;
470 : : int word;
471 : :
472 : : /* Add prefix 0x */
473 : 0 : *p++ = '0';
474 : 0 : *p++ = 'x';
475 : :
476 : : /* Build hex string */
477 [ # # ]: 0 : for (word = nwords - 1; word >= 0; word--) {
478 : 0 : sprintf(p, "%02X", tile_info->ocm_mask[word]);
479 : 0 : p += 2;
480 : : }
481 : :
482 : : /* Terminate */
483 : 0 : *p++ = 0;
484 : 0 : }
485 : :
486 : : void
487 : 0 : cn10k_ml_ocm_print(struct cnxk_ml_dev *cnxk_mldev, FILE *fp)
488 : : {
489 : : struct cn10k_ml_ocm *ocm;
490 : : uint8_t tile_id;
491 : : uint8_t word_id;
492 : : int wb_pages;
493 : : char *str;
494 : :
495 : : ocm = &cnxk_mldev->cn10k_mldev.ocm;
496 : :
497 : : /* Nibbles + prefix '0x' */
498 : 0 : str = rte_zmalloc("ocm_mask_str", ocm->num_pages / 4 + 2, RTE_CACHE_LINE_SIZE);
499 [ # # ]: 0 : if (str == NULL) {
500 : 0 : plt_err("Unable to allocate memory for ocm_mask_str");
501 : 0 : return;
502 : : }
503 : :
504 : : fprintf(fp, "OCM State:\n");
505 [ # # ]: 0 : for (tile_id = 0; tile_id < ocm->num_tiles; tile_id++) {
506 : 0 : cn10k_ml_ocm_pagemask_to_str(&ocm->tile_ocm_info[tile_id], ocm->mask_words, str);
507 : :
508 : 0 : wb_pages = 0 - ocm->tile_ocm_info[tile_id].scratch_pages;
509 [ # # ]: 0 : for (word_id = 0; word_id < ocm->mask_words; word_id++)
510 : 0 : wb_pages += rte_popcount32(ocm->tile_ocm_info[tile_id].ocm_mask[word_id]);
511 : :
512 : 0 : fprintf(fp,
513 : : "tile = %2u, scratch_pages = %4u,"
514 : : " wb_pages = %4d, last_wb_page = %4d,"
515 : : " pagemask = %s\n",
516 : : tile_id, ocm->tile_ocm_info[tile_id].scratch_pages, wb_pages,
517 : : ocm->tile_ocm_info[tile_id].last_wb_page, str);
518 : : }
519 : :
520 : 0 : rte_free(str);
521 : : }
|