 |
ACloudViewer
3.9.4
A Modern Library for 3D Data Processing
|
Go to the documentation of this file.
24 #ifndef DLPACK_DLPACK_H_
25 #define DLPACK_DLPACK_H_
31 #define DLPACK_EXTERN_C extern "C"
33 #define DLPACK_EXTERN_C
37 #define DLPACK_MAJOR_VERSION 1
40 #define DLPACK_MINOR_VERSION 2
45 #define DLPACK_DLL __declspec(dllexport)
47 #define DLPACK_DLL __declspec(dllimport)
90 typedef enum : int32_t {
338 #define DLPACK_FLAG_BITMASK_READ_ONLY (1UL << 0UL)
346 #define DLPACK_FLAG_BITMASK_IS_COPIED (1UL << 1UL)
354 #define DLPACK_FLAG_BITMASK_IS_SUBBYTE_TYPE_PADDED (1UL << 2UL)
433 void (*SetError)(
void* error_ctx,
515 void** out_current_stream
675 #include <fmt/core.h>
676 #include <fmt/format.h>
682 template <
typename FormatContext>
684 FormatContext& ctx)
const -> decltype(ctx.out()) {
685 const char* text =
nullptr;
694 text =
"kDLCUDAHost";
712 text =
"kDLROCMHost";
718 text =
"kDLCUDAManaged";
736 return format_to(ctx.out(), text);
739 template <
typename ParseContext>
740 constexpr
auto parse(ParseContext& ctx) -> decltype(ctx.begin()) {
747 #endif // DLPACK_DLPACK_H_
@ kDLFloat8_e8m0fnu
Definition: DLPack.h:190
@ kDLFloat8_e4m3fnuz
Definition: DLPack.h:187
DLPackDLTensorFromPyObjectNoSync dltensor_from_py_object_no_sync
Producer function pointer for DLPackDLTensorFromPyObject This function can be NULL when the producer ...
Definition: DLPack.h:662
@ kDLBfloat
bfloat16
Definition: DLPack.h:174
The data type the tensor can hold. The data type is assumed to follow the native endian-ness....
Definition: DLPack.h:226
@ kDLComplex
complex number (C/C++/Python layout: compact struct per complex number)
Definition: DLPack.h:179
@ kDLBool
boolean
Definition: DLPack.h:181
DLTensor dl_tensor
DLTensor which is being memory managed.
Definition: DLPack.h:321
@ kDLROCMHost
Pinned ROCm CPU memory allocated by hipMallocHost.
Definition: DLPack.h:115
DLPackManagedTensorFromPyObjectNoSync managed_tensor_from_py_object_no_sync
Producer function pointer for DLPackManagedTensorFromPyObject This function must be not NULL.
Definition: DLPack.h:650
DLPackExchangeAPIHeader header
The header that remains stable across versions.
Definition: DLPack.h:638
uint64_t flags
Additional bitmask flags information about the tensor.
Definition: DLPack.h:398
@ kDLHexagon
Qualcomm Hexagon DSP.
Definition: DLPack.h:136
@ kDLCPU
CPU device.
Definition: DLPack.h:95
@ kDLFloat8_e4m3b11fnuz
Definition: DLPack.h:185
@ kDLCUDAHost
Pinned CUDA CPU memory by cudaMallocHost.
Definition: DLPack.h:101
int(* DLPackManagedTensorToPyObjectNoSync)(DLManagedTensorVersioned *tensor, void **out_py_object)
Imports a DLManagedTensorVersioned to a PyObject* Tensor/NDArray.
Definition: DLPack.h:535
@ kDLFloat
IEEE floating point.
Definition: DLPack.h:166
@ kDLOpaqueHandle
Opaque handle type, reserved for testing purposes. Frameworks need to agree on the handle data type f...
Definition: DLPack.h:172
@ kDLCUDAManaged
CUDA managed/unified memory allocated by cudaMallocManaged.
Definition: DLPack.h:125
@ kDLMAIA
Microsoft MAIA devices.
Definition: DLPack.h:138
struct DLManagedTensor DLManagedTensor
C Tensor object, manage memory of DLTensor. This data structure is intended to facilitate the borrowi...
The DLPack version.
Definition: DLPack.h:79
struct DLPackExchangeAPIHeader DLPackExchangeAPIHeader
DLPackExchangeAPI stable header.
uint64_t byte_offset
The offset in bytes to the beginning pointer to data.
Definition: DLPack.h:302
struct DLManagedTensorVersioned DLManagedTensorVersioned
A versioned and managed C Tensor object, manage memory of DLTensor.
int32_t ndim
Number of dimensions.
Definition: DLPack.h:278
C Tensor object, manage memory of DLTensor. This data structure is intended to facilitate the borrowi...
Definition: DLPack.h:319
struct DLPackExchangeAPI DLPackExchangeAPI
Framework-specific function pointers table for DLPack exchange.
@ kDLFloat8_e5m2
Definition: DLPack.h:188
int(* DLPackManagedTensorAllocator)(DLTensor *prototype, DLManagedTensorVersioned **out, void *error_ctx, void(*SetError)(void *error_ctx, const char *kind, const char *message))
Request a producer library to create a new tensor.
Definition: DLPack.h:429
void * manager_ctx
the context of the original host framework of DLManagedTensor in which DLManagedTensor is used in the...
Definition: DLPack.h:325
A versioned and managed C Tensor object, manage memory of DLTensor.
Definition: DLPack.h:366
@ kDLExtDev
Reserved extension device type, used for quickly test extension device The semantics can differ depen...
Definition: DLPack.h:121
@ kDLVPI
Verilog simulator buffer.
Definition: DLPack.h:109
@ kDLMetal
Metal for Apple GPU.
Definition: DLPack.h:107
@ kDLVulkan
Vulkan buffer for next generation graphics.
Definition: DLPack.h:105
Framework-specific function pointers table for DLPack exchange.
Definition: DLPack.h:634
@ kDLROCM
ROCm GPUs for AMD GPUs.
Definition: DLPack.h:111
DLDeviceType device_type
The device type used in the device.
Definition: DLPack.h:148
uint8_t code
Type code of base types. We keep it uint8_t instead of DLDataTypeCode for minimal memory footprint,...
Definition: DLPack.h:232
int64_t * strides
strides of the tensor (in number of elements, not bytes), can not be NULL if ndim !...
Definition: DLPack.h:300
uint8_t bits
Number of bits, common choices are 8, 16, 32.
Definition: DLPack.h:236
int32_t device_id
The device index. For vanilla CPU memory, pinned memory, or managed memory, this is set to 0.
Definition: DLPack.h:154
@ kDLOneAPI
Unified shared memory allocated on a oneAPI non-partititioned device. Call to oneAPI runtime is requi...
Definition: DLPack.h:132
DLDataType dtype
The data type of the pointer.
Definition: DLPack.h:280
@ kDLCUDA
CUDA GPU device.
Definition: DLPack.h:97
DLPackManagedTensorAllocator managed_tensor_allocator
Producer function pointer for DLPackManagedTensorAllocator This function must not be NULL.
Definition: DLPack.h:644
@ kDLFloat8_e4m3fn
Definition: DLPack.h:186
int(* DLPackCurrentWorkStream)(DLDeviceType device_type, int32_t device_id, void **out_current_stream)
Obtain the current work stream of a device.
Definition: DLPack.h:512
DLDevice device
The device of the tensor.
Definition: DLPack.h:276
DLDeviceType
The device type in DLDevice.
Definition: DLPack.h:92
@ kDLFloat4_e2m1fn
FP4 data types Setting bits != 4 is currently unspecified, and the producer must ensure it is set whi...
Definition: DLPack.h:203
DLPackVersion version
The API and ABI version of the current managed Tensor.
Definition: DLPack.h:370
DLTensor dl_tensor
DLTensor which is being memory managed.
Definition: DLPack.h:400
@ kDLTrn
AWS Trainium.
Definition: DLPack.h:140
void * data
The data pointer points to the allocated data. This will be CUDA device pointer or cl_mem handle in O...
Definition: DLPack.h:274
void(* deleter)(struct DLManagedTensor *self)
Destructor - this should be called to destruct the manager_ctx which backs the DLManagedTensor....
Definition: DLPack.h:332
Definition: IJsonConvertible.h:86
@ kDLFloat8_e3m4
FP8 data types.
Definition: DLPack.h:183
@ kDLUInt
unsigned integer
Definition: DLPack.h:164
@ kDLInt
signed integer
Definition: DLPack.h:162
uint32_t major
DLPack major version.
Definition: DLPack.h:81
@ kDLWebGPU
GPU support for next generation WebGPU standard.
Definition: DLPack.h:134
void * manager_ctx
the context of the original host framework.
Definition: DLPack.h:377
DLDataTypeCode
The type code options DLDataType.
Definition: DLPack.h:160
DLPackManagedTensorToPyObjectNoSync managed_tensor_to_py_object_no_sync
Producer function pointer for DLPackManagedTensorToPyObject This function must be not NULL.
Definition: DLPack.h:656
uint16_t lanes
Number of lanes in the type, used for vector types.
Definition: DLPack.h:238
Plain C Tensor object, does not manage memory.
Definition: DLPack.h:244
int(* DLPackDLTensorFromPyObjectNoSync)(void *py_object, DLTensor *out)
Exports a PyObject* Tensor/NDArray to a provided DLTensor.
Definition: DLPack.h:486
void(* deleter)(struct DLManagedTensorVersioned *self)
Destructor.
Definition: DLPack.h:386
@ kDLOpenCL
OpenCL devices.
Definition: DLPack.h:103
@ kDLFloat8_e5m2fnuz
Definition: DLPack.h:189
DLPackCurrentWorkStream current_work_stream
Producer function pointer for DLPackCurrentWorkStream This function must be not NULL.
Definition: DLPack.h:668
int64_t * shape
The shape of the tensor.
Definition: DLPack.h:286
uint32_t minor
DLPack minor version.
Definition: DLPack.h:83
A Device for Tensor and operator.
Definition: DLPack.h:146
@ kDLFloat6_e2m3fn
FP6 data types Setting bits != 6 is currently unspecified, and the producer must ensure it is set whi...
Definition: DLPack.h:196
int(* DLPackManagedTensorFromPyObjectNoSync)(void *py_object, DLManagedTensorVersioned **out)
Exports a PyObject* Tensor/NDArray to a DLManagedTensorVersioned.
Definition: DLPack.h:456
@ kDLFloat6_e3m2fn
Definition: DLPack.h:197
@ kDLFloat8_e4m3
Definition: DLPack.h:184