Q.ANT Native Computing Toolkit 2.4.0
All you need for photonic computing
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
10namespace 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
51
60
71 QantMemoryHandle *npu_allocate(const uint32_t npu_id, const size_t rows,
72 const size_t cols, const QantDataRole data_role);
73
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
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
Role of a block of device memory.
Definition qant_native_computing_toolkit_generic.h:56
@ Features
Definition qant_native_computing_toolkit_generic.h:58
@ Weights
Definition qant_native_computing_toolkit_generic.h:57
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.
int npu_free(QantMemoryHandle *handle)
Frees a previously allocated block of device memory.
int init_npu(const uint32_t id)
Initialises the Native Processing Unit.
int npu_upload_into(QantMemoryHandle const *handle, DLManagedTensorVersioned const *data)
Uploads a matrix to a previously allocated block of device memory.
DLManagedTensorVersioned * npu_download(QantMemoryHandle const *handle)
Downloads the matrix currently stored in a block of device memory.
int release_npu(const uint32_t id)
Releases an NPU and frees associated memory.
struct QantMemoryHandle QantMemoryHandle
Opaque handle to a block of device memory sized to hold a matrix.
Definition qant_native_computing_toolkit_generic.h:50