StarPU Internal Handbook
memalloc.h
Go to the documentation of this file.
1 /* StarPU --- Runtime system for heterogeneous multicore architectures.
2  *
3  * Copyright (C) 2008-2021 Université de Bordeaux, CNRS (LaBRI UMR 5800), Inria
4  * Copyright (C) 2021 Federal University of Rio Grande do Sul (UFRGS)
5  *
6  * StarPU is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU Lesser General Public License as published by
8  * the Free Software Foundation; either version 2.1 of the License, or (at
9  * your option) any later version.
10  *
11  * StarPU is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14  *
15  * See the GNU Lesser General Public License in COPYING.LGPL for more details.
16  */
17 
18 #ifndef __MEMALLOC_H__
19 #define __MEMALLOC_H__
20 
23 #include <starpu.h>
24 #include <common/config.h>
25 
26 #include <common/list.h>
28 #include <datawizard/coherency.h>
29 #include <datawizard/copy_driver.h>
31 
32 #pragma GCC visibility push(hidden)
33 
35 
38 LIST_TYPE(_starpu_mem_chunk,
40  starpu_data_handle_t data;
41 
42  uint32_t footprint;
43 
44  /*
45  * When re-using a memchunk, the footprint of the data is not
46  * sufficient to determine whether two pieces of data have the same
47  * layout (there could be collision in the hash function ...) so we
48  * still keep a copy of the actual layout (ie. the data interface) to
49  * stay on the safe side while the memchunk is detached from an actual
50  * data.
51  */
52  struct starpu_data_interface_ops *ops;
53  void *chunk_interface;
54  size_t size_interface;
55 
57  unsigned automatically_allocated:1;
60  unsigned relaxed_coherency:2;
62  unsigned home:1;
64  unsigned clean:1;
66  unsigned wontuse:1;
67 
74  size_t size;
75 
76  struct _starpu_data_replicate *replicate;
77 
82  struct _starpu_mem_chunk **remove_notify;
83 )
84 
85 void _starpu_init_mem_chunk_lists(void);
86 void _starpu_deinit_mem_chunk_lists(void);
87 void _starpu_mem_chunk_init_last(void);
88 void _starpu_request_mem_chunk_removal(starpu_data_handle_t handle, struct _starpu_data_replicate *replicate, unsigned node, size_t size);
89 int _starpu_allocate_memory_on_node(starpu_data_handle_t handle, struct _starpu_data_replicate *replicate, enum starpu_is_prefetch is_prefetch, int only_fast_alloc);
90 size_t _starpu_free_all_automatically_allocated_buffers(unsigned node);
91 void _starpu_memchunk_recently_used(struct _starpu_mem_chunk *mc, unsigned node);
92 void _starpu_memchunk_wont_use(struct _starpu_mem_chunk *m, unsigned nodec);
93 void _starpu_memchunk_dirty(struct _starpu_mem_chunk *mc, unsigned node);
94 
95 size_t _starpu_memory_reclaim_generic(unsigned node, unsigned force, size_t reclaim, enum starpu_is_prefetch is_prefetch);
96 int _starpu_is_reclaiming(unsigned node);
97 
98 void _starpu_mem_chunk_disk_register(unsigned disk_memnode);
99 
100 #pragma GCC visibility pop
101 
102 #endif
Definition: coherency.h:47