• Home
  • Raw
  • Download

Lines Matching full:runtime

146   // Release workspace regardless of return status of creating runtime.  in xnn_create_runtime_v3()
153 xnn_runtime_t runtime, in initialize_workspace_blobs() argument
156 assert(runtime->workspace != NULL); in initialize_workspace_blobs()
168 if (runtime->workspace->size < mem_arena_size) { in initialize_workspace_blobs()
169 void* old_workspace_data = runtime->workspace->data; in initialize_workspace_blobs()
170 if (runtime->workspace->size != 0) { in initialize_workspace_blobs()
172 xnn_release_simd_memory(runtime->workspace->data); in initialize_workspace_blobs()
176 xnn_log_error("failed to allocate %zu bytes for runtime workspace", mem_arena_size); in initialize_workspace_blobs()
179 runtime->workspace->data = new_workspace_data; in initialize_workspace_blobs()
180 runtime->workspace->size = mem_arena_size; in initialize_workspace_blobs()
187 assert(runtime->workspace->size >= mem_arena_size); in initialize_workspace_blobs()
189 // Initialize current runtime's blob pointers. in initialize_workspace_blobs()
192 struct xnn_blob* blob = &runtime->blobs[i]; in initialize_workspace_blobs()
195 // Value is purely internal to the runtime, allocate it in the workspace. in initialize_workspace_blobs()
196 …blob->data = (void*) ((uintptr_t) runtime->workspace->data + mem_alloc_tracker->usage[i].alloc_off… in initialize_workspace_blobs()
203 …for (struct xnn_runtime* rt = runtime->workspace->first_user; rt != NULL; rt = rt->next_workspace_… in initialize_workspace_blobs()
204 // The current runtime already has the correct offset. in initialize_workspace_blobs()
205 if (rt == runtime) { in initialize_workspace_blobs()
229 struct xnn_runtime* runtime = NULL; in xnn_create_runtime_v4() local
233 xnn_log_error("failed to create runtime: XNNPACK is not initialized"); in xnn_create_runtime_v4()
238 xnn_log_error("failed to create runtime: workspace is NULL"); in xnn_create_runtime_v4()
253 runtime = xnn_allocate_zero_memory(sizeof(struct xnn_runtime)); in xnn_create_runtime_v4()
254 if (runtime == NULL) { in xnn_create_runtime_v4()
255 … xnn_log_error("failed to allocate %zu bytes for runtime descriptor", sizeof(struct xnn_runtime)); in xnn_create_runtime_v4()
259runtime->opdata = xnn_allocate_zero_memory(sizeof(struct xnn_operator_data) * subgraph->num_nodes); in xnn_create_runtime_v4()
260 if (runtime->opdata == NULL) { in xnn_create_runtime_v4()
265 runtime->num_ops = subgraph->num_nodes; in xnn_create_runtime_v4()
282 code_cache = &runtime->code_cache; in xnn_create_runtime_v4()
300 status = node->create(node, values, subgraph->num_values, runtime->opdata + i, &caches); in xnn_create_runtime_v4()
304 runtime->opdata[i].setup = node->setup; in xnn_create_runtime_v4()
312 runtime->blobs = xnn_allocate_zero_memory(sizeof(struct xnn_blob) * subgraph->num_values); in xnn_create_runtime_v4()
313 if (runtime->blobs == NULL) { in xnn_create_runtime_v4()
318 runtime->num_blobs = subgraph->num_values; in xnn_create_runtime_v4()
325 struct xnn_blob* blob = &runtime->blobs[i]; in xnn_create_runtime_v4()
331 // Value is purely internal to the runtime, and must be allocated in its workspace. in xnn_create_runtime_v4()
335 …// Value is non-static and external to the runtime: must be specified via a call to xnn_setup_runt… in xnn_create_runtime_v4()
346 runtime->workspace = workspace; in xnn_create_runtime_v4()
347 runtime->next_workspace_user = runtime->workspace->first_user; in xnn_create_runtime_v4()
348 runtime->workspace->first_user = runtime; in xnn_create_runtime_v4()
350 status = initialize_workspace_blobs(subgraph, runtime, &mem_alloc_tracker); in xnn_create_runtime_v4()
357 runtime->profiling = true; in xnn_create_runtime_v4()
362 runtime->threadpool = threadpool; in xnn_create_runtime_v4()
364 *runtime_out = runtime; in xnn_create_runtime_v4()
368 xnn_delete_runtime(runtime); in xnn_create_runtime_v4()
373 xnn_runtime_t runtime, in xnn_setup_runtime() argument
378 // This ensures that runtime stays in consistent state in case validation fails midway. in xnn_setup_runtime()
382 if (value_id >= runtime->num_blobs) { in xnn_setup_runtime()
383 xnn_log_error("failed to setup runtime: out-of-bounds ID %" PRIu32 " in external value #%zu", in xnn_setup_runtime()
388 const struct xnn_blob* blob = &runtime->blobs[value_id]; in xnn_setup_runtime()
390 xnn_log_error("failed to setup runtime: Value %" PRIu32 " is not external", value_id); in xnn_setup_runtime()
395 // Apply runtime state changes. in xnn_setup_runtime()
399 struct xnn_blob* blob = &runtime->blobs[value_id]; in xnn_setup_runtime()
403 for (size_t i = 0; i < runtime->num_ops; i++) { in xnn_setup_runtime()
404 const struct xnn_operator_data* opdata = &runtime->opdata[i]; in xnn_setup_runtime()
418 …const enum xnn_status status = opdata->setup(opdata, runtime->blobs, runtime->num_blobs, runtime->… in xnn_setup_runtime()
420 xnn_log_error("failed to setup runtime: error in operator #%zu", i); in xnn_setup_runtime()
478 enum xnn_status xnn_get_runtime_profiling_info(xnn_runtime_t runtime, in xnn_get_runtime_profiling_info() argument
484 if (!runtime->profiling) { in xnn_get_runtime_profiling_info()
489 const struct xnn_operator_data* opdata = runtime->opdata; in xnn_get_runtime_profiling_info()
498 for (size_t i = 0; i < runtime->num_ops; ++i) { in xnn_get_runtime_profiling_info()
507 for (size_t i = 0; i < runtime->num_ops; ++i) { in xnn_get_runtime_profiling_info()
522 for (size_t i = 0; i < runtime->num_ops; ++i) { in xnn_get_runtime_profiling_info()
541 for (size_t i = 0; i < runtime->num_ops; ++i) { in xnn_get_runtime_profiling_info()
551 xnn_timestamp previous_ts = runtime->start_ts; in xnn_get_runtime_profiling_info()
553 for (size_t i = 0; i < runtime->num_ops; ++i) { in xnn_get_runtime_profiling_info()
575 xnn_runtime_t runtime) in xnn_invoke_runtime() argument
577 if (runtime->profiling) { in xnn_invoke_runtime()
578 runtime->start_ts = xnn_read_timer(); in xnn_invoke_runtime()
580 for (size_t i = 0; i < runtime->num_ops; i++) { in xnn_invoke_runtime()
582 if (runtime->opdata[i].operator_objects[j] == NULL) { in xnn_invoke_runtime()
587 …const enum xnn_status status = xnn_run_operator(runtime->opdata[i].operator_objects[j], runtime->t… in xnn_invoke_runtime()
591 if (runtime->profiling) { in xnn_invoke_runtime()
592 runtime->opdata[i].end_ts[j] = xnn_read_timer(); in xnn_invoke_runtime()
600 xnn_runtime_t runtime) in xnn_delete_runtime() argument
602 if (runtime != NULL) { in xnn_delete_runtime()
603 if (runtime->opdata != NULL) { in xnn_delete_runtime()
604 for (size_t i = 0; i < runtime->num_ops; i++) { in xnn_delete_runtime()
606 xnn_delete_operator(runtime->opdata[i].operator_objects[j]); in xnn_delete_runtime()
609 xnn_release_memory(runtime->opdata); in xnn_delete_runtime()
611 xnn_release_memory(runtime->blobs); in xnn_delete_runtime()
612 if (runtime->workspace != NULL) { in xnn_delete_runtime()
613 // Remove this runtime from the list of users of the workspace. in xnn_delete_runtime()
614 assert(runtime->workspace->first_user != NULL); in xnn_delete_runtime()
615 if (runtime->workspace->first_user == runtime) { in xnn_delete_runtime()
616 runtime->workspace->first_user = runtime->next_workspace_user; in xnn_delete_runtime()
618 xnn_runtime_t prev = runtime->workspace->first_user; in xnn_delete_runtime()
620 while (curr != runtime) { in xnn_delete_runtime()
624 assert(curr == runtime); in xnn_delete_runtime()
627 xnn_release_workspace(runtime->workspace); in xnn_delete_runtime()
631 xnn_release_code_cache(&runtime->code_cache); in xnn_delete_runtime()
633 xnn_release_memory(runtime); in xnn_delete_runtime()