|
| 1 | +.. Licensed to the Apache Software Foundation (ASF) under one |
| 2 | + or more contributor license agreements. See the NOTICE file |
| 3 | + distributed with this work for additional information |
| 4 | + regarding copyright ownership. The ASF licenses this file |
| 5 | + to you under the Apache License, Version 2.0 (the |
| 6 | + "License"); you may not use this file except in compliance |
| 7 | + with the License. You may obtain a copy of the License at |
| 8 | +
|
| 9 | +.. http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +
|
| 11 | +.. Unless required by applicable law or agreed to in writing, |
| 12 | + software distributed under the License is distributed on an |
| 13 | + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 14 | + KIND, either express or implied. See the License for the |
| 15 | + specific language governing permissions and limitations |
| 16 | + under the License. |
| 17 | +
|
| 18 | +C++ API |
| 19 | +======= |
| 20 | + |
| 21 | +This page contains the API reference for the C++ API. The full API index below |
| 22 | +can be a bit dense, so we recommend the following tips first: |
| 23 | + |
| 24 | +- Please read the :ref:`C++ Guide<cpp-guide>` for a high-level overview of the C++ API. |
| 25 | + |
| 26 | + - The C++ Guide and examples will likely be sufficient to get started with most use cases. |
| 27 | + |
| 28 | +- The :ref:`cpp-key-classes` lists the key classes that are most commonly used. |
| 29 | +- You can go to the Full API Index at the bottom of this page to access the full list of APIs. |
| 30 | + |
| 31 | + - We usually group the APIs by files. You can look at the file hierarchy in the |
| 32 | + full API index and navigate to the specific file to find the APIs in that file. |
| 33 | + |
| 34 | +Header Organization |
| 35 | +------------------- |
| 36 | + |
| 37 | +The C++ APIs are organized into the following folders: |
| 38 | + |
| 39 | +.. list-table:: |
| 40 | + :header-rows: 1 |
| 41 | + :widths: 30 70 |
| 42 | + |
| 43 | + * - Folder |
| 44 | + - Description |
| 45 | + * - ``tvm/ffi/`` |
| 46 | + - Core functionalities that support Function, Any, Object, etc. |
| 47 | + * - ``tvm/ffi/container/`` |
| 48 | + - Additional container types such as Array, Map, Shape, Tensor, Variant ... |
| 49 | + * - ``tvm/ffi/reflection/`` |
| 50 | + - Reflection support for function and type information registration. |
| 51 | + * - ``tvm/ffi/extra/`` |
| 52 | + - Extra APIs that are built on top. |
| 53 | + |
| 54 | + |
| 55 | +.. _cpp-key-classes: |
| 56 | + |
| 57 | +Key Classes |
| 58 | +----------- |
| 59 | + |
| 60 | +.. list-table:: |
| 61 | + :header-rows: 1 |
| 62 | + :widths: 30 70 |
| 63 | + |
| 64 | + * - Class |
| 65 | + - Description |
| 66 | + * - :cpp:class:`tvm::ffi::Function` |
| 67 | + - Type-erased function that implements the ABI. |
| 68 | + * - :cpp:class:`tvm::ffi::Any` |
| 69 | + - Type-erased container for any supported value. |
| 70 | + * - :cpp:class:`tvm::ffi::AnyView` |
| 71 | + - Lightweight view of Any without ownership. |
| 72 | + * - :cpp:class:`tvm::ffi::Object` |
| 73 | + - Base class for all heap-allocated FFI objects. |
| 74 | + * - :cpp:class:`tvm::ffi::ObjectRef` |
| 75 | + - Reference class for objects. |
| 76 | + * - :cpp:class:`tvm::ffi::Tensor` |
| 77 | + - Multi-dimensional tensor with DLPack support. |
| 78 | + * - :cpp:class:`tvm::ffi::Shape` |
| 79 | + - Tensor shape container. |
| 80 | + * - :cpp:class:`tvm::ffi::Module` |
| 81 | + - Dynamic library module that can load exported functions. |
| 82 | + * - :cpp:class:`tvm::ffi::String` |
| 83 | + - String type for FFI. |
| 84 | + * - :cpp:class:`tvm::ffi::Bytes` |
| 85 | + - Byte array type. |
| 86 | + * - :cpp:class:`tvm::ffi::Array` |
| 87 | + - Dynamic array container. |
| 88 | + * - :cpp:class:`tvm::ffi::Tuple` |
| 89 | + - Heterogeneous tuple container. |
| 90 | + * - :cpp:class:`tvm::ffi::Map` |
| 91 | + - Key-value map container. |
| 92 | + * - :cpp:class:`tvm::ffi::Optional` |
| 93 | + - Optional value wrapper. |
| 94 | + * - :cpp:class:`tvm::ffi::Variant` |
| 95 | + - Type-safe union container. |
| 96 | + |
| 97 | + |
| 98 | + |
| 99 | +.. _cpp-full-api-index: |
| 100 | + |
| 101 | +Full API Index |
| 102 | +-------------- |
| 103 | + |
| 104 | +.. toctree:: |
| 105 | + :maxdepth: 2 |
| 106 | + |
| 107 | + generated/index.rst |
0 commit comments