Coverage Report

Created: 2024-08-18 16:21

/home/liu/actions-runner/_work/ccv/ccv/lib/nnc/ccv_nnc_dynamic_graph_alloc.c
Line
Count
Source (jump to first uncovered line)
1
#include "ccv_nnc.h"
2
#include "ccv_nnc_easy.h"
3
#include "ccv_nnc_internal.h"
4
#include "ccv_nnc_easy.h"
5
#include "ccv_internal.h"
6
#include "_ccv_nnc_dynamic_graph.h"
7
#ifdef HAVE_MPS
8
#include "mps/ccv_nnc_mps.h"
9
#endif
10
11
void ccv_nnc_dynamic_graph_gc(ccv_nnc_dynamic_graph_t* const graph)
12
0
{
13
0
  ccv_nnc_xpu_gc(-1, &graph->xpu_alloc);
14
#ifdef HAVE_MPS
15
  ccv_nnc_mps_clear_graph_executable_cache();
16
#endif
17
0
}
18
19
ccv_nnc_compilation_artifact_t* ccv_nnc_compilation_artifact_new(ccv_nnc_graph_t* const graph, ccv_nnc_tensor_arena_t* const tensor_arena, ccv_nnc_graph_exec_arena_t* const exec_arena)
20
204
{
21
204
  ccv_nnc_compilation_artifact_t* const artifact = (ccv_nnc_compilation_artifact_t*)ccmalloc(sizeof(ccv_nnc_compilation_artifact_t));
22
204
  artifact->graph = graph;
23
204
  artifact->tensor_arena = tensor_arena;
24
204
  artifact->exec_arena = exec_arena;
25
204
  return artifact;
26
204
}
27
28
void ccv_nnc_compilation_artifact_free(ccv_nnc_compilation_artifact_t* const artifact)
29
204
{
30
204
  ccv_nnc_graph_free(artifact->graph);
31
204
  ccv_nnc_tensor_arena_free(artifact->tensor_arena);
32
204
  ccv_nnc_graph_exec_arena_free(artifact->exec_arena);
33
204
  ccfree(artifact);
34
204
}