Q.ANT Native Computing Toolkit
2.4.0
All you need for photonic computing
Toggle main menu visibility
Loading...
Searching...
No Matches
qant_native_computing_toolkit_generic.h
Go to the documentation of this file.
1
#ifndef QANT_NATIVE_COMPUTING_TOOLKIT_GENERIC_H
2
#define QANT_NATIVE_COMPUTING_TOOLKIT_GENERIC_H
3
4
#include <stddef.h>
5
#include <stdint.h>
6
7
#include <dlpack/dlpack.h>
8
9
#ifdef __cplusplus
10
namespace
qant_native_computing_toolkit::generic
11
{
12
extern
"C"
13
{
14
#endif
15
31
int
init_npu
(
const
uint32_t
id
);
32
42
int
release_npu
(
const
uint32_t
id
);
43
50
typedef
struct
QantMemoryHandle
QantMemoryHandle
;
51
55
typedef
enum
QantDataRole
56
{
57
Weights
,
58
Features
,
59
}
QantDataRole
;
60
71
QantMemoryHandle
*
npu_allocate
(
const
uint32_t npu_id,
const
size_t
rows,
72
const
size_t
cols,
const
QantDataRole
data_role);
73
81
int
npu_free
(
QantMemoryHandle
*handle);
82
92
QantMemoryHandle
*
npu_upload
(
const
uint32_t npu_id, DLManagedTensorVersioned
const
*data,
93
const
QantDataRole
data_role);
94
102
int
npu_upload_into
(
QantMemoryHandle
const
*handle, DLManagedTensorVersioned
const
*data);
103
110
DLManagedTensorVersioned *
npu_download
(
QantMemoryHandle
const
*handle);
111
112
#ifdef __cplusplus
113
}
// extern "C"
114
}
// namespace qant_native_computing_toolkit::generic
115
#endif
116
117
#endif
// QANT_NATIVE_COMPUTING_TOOLKIT_GENERIC_H
npu_allocate
QantMemoryHandle * npu_allocate(const uint32_t npu_id, const size_t rows, const size_t cols, const QantDataRole data_role)
Allocates a block of device memory sized to hold a (rows, cols) matrix.
QantDataRole
QantDataRole
Role of a block of device memory.
Definition
qant_native_computing_toolkit_generic.h:56
Features
@ Features
Definition
qant_native_computing_toolkit_generic.h:58
Weights
@ Weights
Definition
qant_native_computing_toolkit_generic.h:57
npu_upload
QantMemoryHandle * npu_upload(const uint32_t npu_id, DLManagedTensorVersioned const *data, const QantDataRole data_role)
Allocates a block of device memory and uploads a matrix to it.
npu_free
int npu_free(QantMemoryHandle *handle)
Frees a previously allocated block of device memory.
init_npu
int init_npu(const uint32_t id)
Initialises the Native Processing Unit.
npu_upload_into
int npu_upload_into(QantMemoryHandle const *handle, DLManagedTensorVersioned const *data)
Uploads a matrix to a previously allocated block of device memory.
npu_download
DLManagedTensorVersioned * npu_download(QantMemoryHandle const *handle)
Downloads the matrix currently stored in a block of device memory.
release_npu
int release_npu(const uint32_t id)
Releases an NPU and frees associated memory.
QantMemoryHandle
struct QantMemoryHandle QantMemoryHandle
Opaque handle to a block of device memory sized to hold a matrix.
Definition
qant_native_computing_toolkit_generic.h:50
qant_native_computing_toolkit_generic.h
Generated on
for Q.ANT Native Computing Toolkit by
1.17.0