Lines Matching full:workspace

44     xnn_log_error("failed to create workspace: XNNPACK is not initialized");  in xnn_create_workspace()
48 struct xnn_workspace* workspace = NULL; in xnn_create_workspace() local
49 workspace = xnn_allocate_zero_memory(sizeof(struct xnn_workspace)); in xnn_create_workspace()
50 if (workspace == NULL) { in xnn_create_workspace()
51 …xnn_log_error("failed to allocate %zu bytes for workspace descriptor", sizeof(struct xnn_workspace… in xnn_create_workspace()
54 workspace->ref_count = 1; in xnn_create_workspace()
55 *workspace_out = workspace; in xnn_create_workspace()
59 static inline void xnn_retain_workspace(xnn_workspace_t workspace) in xnn_retain_workspace() argument
61 workspace->ref_count++; in xnn_retain_workspace()
64 enum xnn_status xnn_release_workspace(xnn_workspace_t workspace) in xnn_release_workspace() argument
66 assert(workspace->ref_count != 0); in xnn_release_workspace()
67 if (--workspace->ref_count == 0) { in xnn_release_workspace()
68 xnn_release_simd_memory(workspace->data); in xnn_release_workspace()
69 xnn_release_memory(workspace); in xnn_release_workspace()
140 xnn_workspace_t workspace; in xnn_create_runtime_v3() local
141 enum xnn_status status = xnn_create_workspace(&workspace); in xnn_create_runtime_v3()
145 …status = xnn_create_runtime_v4(subgraph, weights_cache, workspace, threadpool, flags, runtime_out); in xnn_create_runtime_v3()
146 // Release workspace regardless of return status of creating runtime. in xnn_create_runtime_v3()
147 xnn_release_workspace(workspace); in xnn_create_runtime_v3()
156 assert(runtime->workspace != NULL); in initialize_workspace_blobs()
165 // Records how much the workspace has moved by due to allocating a larger workspace. in initialize_workspace_blobs()
167 // Allocates larger workspace here if needed. 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()
171 … // Free up the workspace's current data. Free first then allocate to keep peak memory usage low. 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()
181 // Keep track of how much the workspace data moved. in initialize_workspace_blobs()
187 assert(runtime->workspace->size >= mem_arena_size); 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()
201 // Adjust the blob pointers of all runtimes that share this workspace. in initialize_workspace_blobs()
203 …for (struct xnn_runtime* rt = runtime->workspace->first_user; rt != NULL; rt = rt->next_workspace_… in initialize_workspace_blobs()
224 xnn_workspace_t workspace, in xnn_create_runtime_v4() argument
237 if (workspace == NULL) { in xnn_create_runtime_v4()
238 xnn_log_error("failed to create runtime: workspace is NULL"); 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()
345 xnn_retain_workspace(workspace); 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()
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()
627 xnn_release_workspace(runtime->workspace); in xnn_delete_runtime()