NVIDIA IndeX API nvidia_logo_transpbg.gif Up
imemory_allocator.h
Go to the documentation of this file.
1/******************************************************************************
2 * Copyright 2023 NVIDIA Corporation. All rights reserved.
3 *****************************************************************************/
6
7#ifndef NVIDIA_INDEX_IMEMORY_ALLOCATOR_H
8#define NVIDIA_INDEX_IMEMORY_ALLOCATOR_H
9
10#include <mi/dice.h>
11#include <mi/base/interface_declare.h>
12
13// CUDA forward declarations required for the interfaces below
14struct cudaArray;
15struct cudaChannelFormatDesc;
16
17namespace nv {
18namespace index {
19
21class ICuda_memory_allocator;
22
23class IMemory_allocator_configuration :
24 public mi::base::Interface_declare<0x35cb18dd,0x6523,0x4362,0x92,0xb2,0xda,0xc4,0xb,0x3a,0x91,0xfd>
25{
26public:
33 virtual mi::Sint32 set_memory_allocator(
34 ICuda_memory_allocator* alloc) = 0;
35
40 virtual ICuda_memory_allocator* get_memory_allocator() const = 0;
41};
42
49 public mi::base::Interface_declare<0xea832c47,0x6dfa,0x41ba,0xb3,0x1c,0xa3,0xcf,0x4e,0x35,0x53,0x91>
50{
51public:
52 struct Buffer_data {
53 mi::Sint32 device_id;
54 void* data;
55 const void* user_data;
58
59 mi::Size used_pitch;
61 };
62
63 struct Array_data {
64 mi::Sint32 device_id;
65 cudaArray* array;
66 const void* user_data;
69 };
70
71public:
72 virtual Buffer_data device_alloc(
73 mi::Sint32 device_id,
74 mi::Size data_size) = 0;
75 virtual Buffer_data device_alloc_pitched(
76 mi::Sint32 device_id,
77 mi::Uint32 size_x_in_bytes,
78 mi::Uint32 size_y) = 0;
79
80 virtual Array_data device_alloc_array(
81 mi::Sint32 device_id,
82 const mi::math::Vector_struct<mi::Uint32, 3>& arr_dim,
83 const cudaChannelFormatDesc* arr_chdesc,
84 mi::Uint32 arr_flags) = 0;
85
86 virtual void device_free(
87 Buffer_data& buffer_data) = 0;
88 virtual void device_free(
89 Array_data& array_data) = 0;
90};
91
92} // namespace index
93} // namespace nv
94
95#endif // NVIDIA_INDEX_IMEMORY_ALLOCATOR_H
Interface class allowing applications to implement a custom CUDA-memory allocation mechanism.
Definition: imemory_allocator.h:50
Common namespace for all NVIDIA APIs.
Definition: iindex.h:349