Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ option(WITH_ASCEND "Enable Ascend backend" OFF)

option(AUTO_DETECT_DEVICES "Automatically detect available devices" OFF)
option(INFINI_RT_BUILD_TESTING "Build InfiniRT tests" OFF)
option(INFINI_RT_BUILD_DOCS "Build InfiniRT documentation" OFF)

if(AUTO_DETECT_DEVICES)
message(STATUS "Auto-detecting available devices...")
Expand Down Expand Up @@ -336,3 +337,22 @@ if(INFINI_RT_BUILD_TESTING)
enable_testing()
add_subdirectory(tests)
endif()

if(INFINI_RT_BUILD_DOCS)
find_package(Doxygen REQUIRED)

set(INFINI_RT_DOXYGEN_OUTPUT_DIRECTORY
"${CMAKE_BINARY_DIR}/docs/reference")
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/docs/Doxyfile.in"
"${CMAKE_BINARY_DIR}/docs/Doxyfile"
@ONLY)

add_custom_target(infinirt_docs
COMMAND ${CMAKE_COMMAND} -E make_directory
"${INFINI_RT_DOXYGEN_OUTPUT_DIRECTORY}"
COMMAND ${DOXYGEN_EXECUTABLE} "${CMAKE_BINARY_DIR}/docs/Doxyfile"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Generating InfiniRT documentation"
VERBATIM)
endif()
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
# InfiniRT

InfiniRT is the runtime library of the InfiniCore project. It provides a stable runtime API for device management and memory operations across supported backends such as CPU and NVIDIA.
InfiniRT is the runtime library of the InfiniCore project. It provides the
public runtime entry for supported accelerator backends, starting with device
management and memory operations and growing with higher-level runtime
features.

The recommended public entry is:

```cpp
#include <infini/rt.h>
```

Full user documentation is available in [docs/README.md](docs/README.md).

## Build and Install

Configure, build, and install InfiniRT with CMake:
Expand Down Expand Up @@ -63,6 +68,7 @@ cmake --install build

```cpp
#include <cstddef>

#include <infini/rt.h>

int main() {
Expand Down Expand Up @@ -128,6 +134,9 @@ At runtime, make sure the dynamic linker can find `libinfinirt.so`, for example:
export LD_LIBRARY_PATH=/path/to/infini-rt-prefix/lib:$LD_LIBRARY_PATH
```

See [examples/consumer_cmake](examples/consumer_cmake) for a minimal CMake
consumer project.

## Tests

Enable C++ tests with:
Expand Down
173 changes: 173 additions & 0 deletions docs/Doxyfile.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
PROJECT_NAME = "InfiniRT"
PROJECT_BRIEF = "Runtime API for Accelerators"
OUTPUT_DIRECTORY = @INFINI_RT_DOXYGEN_OUTPUT_DIRECTORY@
CREATE_SUBDIRS = NO
ALLOW_UNICODE_NAMES = NO
OUTPUT_LANGUAGE = English
BRIEF_MEMBER_DESC = YES
REPEAT_BRIEF = YES
FULL_PATH_NAMES = NO
JAVADOC_AUTOBRIEF = YES
QT_AUTOBRIEF = NO
MULTILINE_CPP_IS_BRIEF = NO
TAB_SIZE = 2
OPTIMIZE_OUTPUT_FOR_C = NO
OPTIMIZE_OUTPUT_JAVA = NO
OPTIMIZE_FOR_FORTRAN = NO
OPTIMIZE_OUTPUT_VHDL = NO
EXTENSION_MAPPING =
MARKDOWN_SUPPORT = YES
TOC_INCLUDE_HEADINGS = 5
AUTOLINK_SUPPORT = YES
BUILTIN_STL_SUPPORT = YES
CPP_CLI_SUPPORT = NO
SIP_SUPPORT = NO
IDL_PROPERTY_SUPPORT = YES
DISTRIBUTE_GROUP_DOC = NO
GROUP_NESTED_COMPOUNDS = NO
SUBGROUPING = YES
INLINE_GROUPED_CLASSES = NO
INLINE_SIMPLE_STRUCTS = NO
TYPEDEF_HIDES_STRUCT = NO
LOOKUP_CACHE_SIZE = 0
EXTRACT_ALL = YES
EXTRACT_PRIVATE = NO
EXTRACT_PRIV_VIRTUAL = NO
EXTRACT_PACKAGE = NO
EXTRACT_STATIC = YES
EXTRACT_LOCAL_CLASSES = NO
EXTRACT_LOCAL_METHODS = NO
EXTRACT_ANON_NSPACES = NO
HIDE_UNDOC_MEMBERS = NO
HIDE_UNDOC_CLASSES = NO
HIDE_FRIEND_COMPOUNDS = YES
HIDE_IN_BODY_DOCS = NO
INTERNAL_DOCS = NO
CASE_SENSE_NAMES = YES
HIDE_SCOPE_NAMES = NO
HIDE_COMPOUND_REFERENCE= NO
SHOW_INCLUDE_FILES = YES
SHOW_GROUPED_MEMB_INC = NO
FORCE_LOCAL_INCLUDES = NO
INLINE_INFO = YES
SORT_MEMBER_DOCS = YES
SORT_BRIEF_DOCS = NO
SORT_MEMBERS_CTORS_1ST = NO
SORT_GROUP_NAMES = NO
SORT_BY_SCOPE_NAME = NO
STRICT_PROTO_MATCHING = NO
GENERATE_TODOLIST = YES
GENERATE_TESTLIST = YES
GENERATE_BUGLIST = YES
GENERATE_DEPRECATEDLIST= YES
ENABLED_SECTIONS =
MAX_INITIALIZER_LINES = 30
SHOW_USED_FILES = YES
SHOW_FILES = YES
SHOW_NAMESPACES = YES
FILE_VERSION_FILTER =
LAYOUT_FILE =
CITE_BIB_FILES =
QUIET = NO
WARNINGS = YES
WARN_IF_UNDOCUMENTED = NO
WARN_IF_DOC_ERROR = YES
WARN_NO_PARAMDOC = NO
WARN_AS_ERROR = NO
INPUT = README.md \
docs \
docs/api \
include/infini/rt.h \
generated/include/infini/rt/generated.h \
src/data_type.h \
src/device.h \
src/runtime.h \
src/tensor_view.h
INPUT_ENCODING = UTF-8
FILE_PATTERNS = *.md \
*.h
RECURSIVE = NO
EXCLUDE =
EXCLUDE_SYMLINKS = YES
EXCLUDE_PATTERNS = */infini/rt/detail/* \
*/generated/src/*
EXCLUDE_SYMBOLS = *::detail::* \
*::generated_detail::* \
*::tensor_view_detail::*
EXAMPLE_PATH = examples
EXAMPLE_PATTERNS = *.cc \
CMakeLists.txt
EXAMPLE_RECURSIVE = YES
IMAGE_PATH =
INPUT_FILTER =
FILTER_PATTERNS =
FILTER_SOURCE_FILES = NO
FILTER_SOURCE_PATTERNS =
USE_MDFILE_AS_MAINPAGE = docs/README.md
SOURCE_BROWSER = NO
INLINE_SOURCES = NO
STRIP_CODE_COMMENTS = YES
REFERENCED_BY_RELATION = NO
REFERENCES_RELATION = NO
REFERENCES_LINK_SOURCE = YES
SOURCE_TOOLTIPS = YES
USE_HTAGS = NO
VERBATIM_HEADERS = YES
ALPHABETICAL_INDEX = YES
GENERATE_HTML = YES
HTML_OUTPUT = html
HTML_FILE_EXTENSION = .html
HTML_COLORSTYLE = LIGHT
HTML_DYNAMIC_SECTIONS = NO
GENERATE_TREEVIEW = YES
ENUM_VALUES_PER_LINE = 4
TREEVIEW_WIDTH = 250
EXT_LINKS_IN_WINDOW = NO
OBFUSCATE_EMAILS = YES
HTML_FORMULA_FORMAT = png
FORMULA_FONTSIZE = 10
USE_MATHJAX = NO
SEARCHENGINE = YES
SERVER_BASED_SEARCH = NO
EXTERNAL_SEARCH = NO
GENERATE_LATEX = NO
GENERATE_XML = NO
GENERATE_DOCBOOK = NO
GENERATE_AUTOGEN_DEF = NO
GENERATE_PERLMOD = NO
ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = NO
EXPAND_ONLY_PREDEF = NO
SEARCH_INCLUDES = YES
INCLUDE_PATH = include \
generated/include \
src
INCLUDE_FILE_PATTERNS =
PREDEFINED =
SKIP_FUNCTION_MACROS = YES
TAGFILES =
GENERATE_TAGFILE =
ALLEXTERNALS = NO
EXTERNAL_GROUPS = YES
EXTERNAL_PAGES = YES
HAVE_DOT = NO
DOT_NUM_THREADS = 0
UML_LOOK = NO
TEMPLATE_RELATIONS = NO
CALL_GRAPH = NO
CALLER_GRAPH = NO
GRAPHICAL_HIERARCHY = YES
DIRECTORY_GRAPH = YES
DOT_IMAGE_FORMAT = png
INTERACTIVE_SVG = NO
DOT_PATH =
DOTFILE_DIRS =
MSCFILE_DIRS =
DIAFILE_DIRS =
PLANTUML_JAR_PATH =
PLANTUML_CFG_FILE =
DOT_GRAPH_MAX_NODES = 50
MAX_DOT_GRAPH_DEPTH = 0
DOT_MULTI_TARGETS = NO
GENERATE_LEGEND = YES
DOT_CLEANUP = YES
26 changes: 26 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# InfiniRT Documentation

InfiniRT is the runtime layer of the InfiniCore project. This documentation
starts with the public runtime surface available today and is intended to grow
with lower-level backend capabilities and higher-level user-facing features as
they are added.

The supported public include entry is:

```cpp
#include <infini/rt.h>
```

Start with these pages:

- [Getting Started](getting-started.md): install InfiniRT and compile a minimal
consumer.
- [Build and Test](build.md): CMake options for CPU, NVIDIA, and other
backends.
- [Runtime API](api/runtime.md): the runtime namespace and backend dispatch
model.
- [Core Types](api/core-types.md): `Device`, `DataType`, and `TensorView`.
- [Backends](backends.md): supported backend options and API support notes.
- [Compatibility](compatibility.md): stable API boundary and internal headers.

API reference generation is described in [API Reference](api/reference.md).
68 changes: 68 additions & 0 deletions docs/api/core-types.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Core Types

Core types are available through:

```cpp
#include <infini/rt.h>
```

## Device

`infini::rt::Device` identifies a backend type and an index.

```cpp
infini::rt::Device device{infini::rt::Device::Type::kCpu, 0};
auto type = device.type();
auto index = device.index();
```

Known device types include:

- `Device::Type::kCpu`
- `Device::Type::kNvidia`
- `Device::Type::kIluvatar`
- `Device::Type::kMetax`
- `Device::Type::kMoore`
- `Device::Type::kHygon`
- `Device::Type::kCambricon`
- `Device::Type::kAscend`

## DataType

`infini::rt::DataType` describes tensor element types.

Supported values include signed integers, unsigned integers, reduced precision
floating point, and standard floating point types:

- `kInt8`, `kInt16`, `kInt32`, `kInt64`
- `kUInt8`, `kUInt16`, `kUInt32`, `kUInt64`
- `kFloat16`, `kBFloat16`, `kFloat32`, `kFloat64`

## TensorView

`infini::rt::TensorView` is a non-owning description of tensor memory.

```cpp
std::vector<float> data(16);

infini::rt::TensorView tensor{
data.data(),
std::vector<std::size_t>{4, 4},
infini::rt::DataType::kFloat32,
infini::rt::Device{infini::rt::Device::Type::kCpu, 0},
std::vector<std::ptrdiff_t>{4, 1}};

auto elements = tensor.numel();
auto bytes_per_element = tensor.element_size();
auto contiguous = tensor.IsContiguous();
```

`TensorView` stores:

- data pointer
- shape
- data type
- device
- strides

It does not own the memory it references.
55 changes: 55 additions & 0 deletions docs/api/reference.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# API Reference

InfiniRT keeps user-facing documentation in Markdown and can generate a C++ API
reference with Doxygen.

## Generate Reference HTML

Configure a build first so that generated public headers exist:

```bash
cmake -S . -B build -DWITH_CPU=ON
```

Then generate it through CMake:

```bash
cmake -S . -B build -DINFINI_RT_BUILD_DOCS=ON
cmake --build build --target infinirt_docs
```

The generated HTML is written under:

```text
build/docs/reference/html
```

## Preview the Rendered Structure

Serve the generated HTML directory with a local static file server:

```bash
python3 -m http.server 8000 --directory build/docs/reference/html
```

Then open:

```text
http://localhost:8000/
```

The Doxygen page includes a left-side tree view and search box, which are the
recommended way to inspect the rendered API structure.

## Reference Scope

The Doxygen configuration is intentionally scoped to the public entry header,
core public headers, and generated dispatching runtime declarations.

The following are not intended as the primary user documentation surface:

- `infini/rt/detail/*`
- backend implementation detail copied from `src/native/*`
- generated implementation source under `generated/src`

Use [Compatibility](../compatibility.md) for the supported API boundary.
Loading
Loading