This is an automated email from the ASF dual-hosted git repository.
tqchen pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm-ffi.git
The following commit(s) were added to refs/heads/main by this push:
new 3bc6418 doc: Enable Doxygen Build Checks in CI (#42)
3bc6418 is described below
commit 3bc64186e23f097c4b44c3da2be314ea04740565
Author: Junru Shao <[email protected]>
AuthorDate: Mon Sep 22 16:39:03 2025 -0700
doc: Enable Doxygen Build Checks in CI (#42)
Previously `BUILD_CPP_DOCS` is not turned on in CI, and careless small
errors may occur across cpp doc updates. This PR turns it on, so that
all docs are well-tested in CI.
<img width="951" height="412" alt="image"
src="https://github.com/user-attachments/assets/d774b400-86c3-4ca9-aa39-7b156e5d33a6"
/>
---
.github/workflows/ci_test.yml | 3 ++-
docs/conf.py | 26 ++++++++++++++++----
include/tvm/ffi/c_api.h | 41 ++++++++++++++++++++++++--------
include/tvm/ffi/container/map.h | 6 +++++
include/tvm/ffi/container/tensor.h | 1 -
include/tvm/ffi/reflection/access_path.h | 1 -
include/tvm/ffi/reflection/registry.h | 4 +---
7 files changed, 61 insertions(+), 21 deletions(-)
diff --git a/.github/workflows/ci_test.yml b/.github/workflows/ci_test.yml
index 91f6bbd..eee0c55 100644
--- a/.github/workflows/ci_test.yml
+++ b/.github/workflows/ci_test.yml
@@ -65,7 +65,8 @@ jobs:
python-version: 3.13
- name: Generate docs
run: |
- uv run --group docs sphinx-build -W --keep-going -b html docs
docs/_build/html
+ sudo apt install doxygen
+ BUILD_CPP_DOCS=1 uv run --group docs sphinx-build -W --keep-going -b
html docs docs/_build/html
test:
needs: [lint, prepare]
diff --git a/docs/conf.py b/docs/conf.py
index 69df5ca..50495de 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -71,14 +71,16 @@ breathe_projects = {"tvm-ffi": "./_build/doxygen/xml"}
exhaleDoxygenStdin = """
INPUT = ../include
-PREDEFINED += TVM_FFI_DLL= TVM_FFI_INLINE= TVM_FFI_EXTRA_CXX_API=
__cplusplus=201703
-
-EXCLUDE_SYMBOLS += *details* *TypeTraits* std \
+PREDEFINED += TVM_FFI_DLL= TVM_FFI_DLL_EXPORT= TVM_FFI_INLINE= \
+ TVM_FFI_EXTRA_CXX_API= TVM_FFI_WEAK=
TVM_FFI_DOXYGEN_MODE \
+ __cplusplus=201703
+EXCLUDE_SYMBOLS += *details* *TypeTraits* std \
*use_default_type_traits_v* *is_optional_type_v*
*operator* \
-
-EXCLUDE_PATTERNS += *details.h
+EXCLUDE_PATTERNS += *details.h
ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = YES
+WARNINGS = YES
+WARN_AS_ERROR = FAIL_ON_WARNINGS_PRINT # if your Doxygen version
supports it
"""
exhaleAfterTitleDescription = """
@@ -97,6 +99,20 @@ exhale_args = {
"afterTitleDescription": exhaleAfterTitleDescription,
}
nbsphinx_allow_errors = True
+cpp_id_attributes = [
+ "TVM_FFI_DLL",
+ "TVM_FFI_DLL_EXPORT",
+ "TVM_FFI_INLINE",
+ "TVM_FFI_EXTRA_CXX_API",
+ "TVM_FFI_WEAK",
+]
+
+c_id_attributes = [
+ "TVM_FFI_DLL",
+ "TVM_FFI_DLL_EXPORT",
+ "TVM_FFI_WEAK",
+]
+
nbsphinx_execute = "never"
autosectionlabel_prefix_document = True
diff --git a/include/tvm/ffi/c_api.h b/include/tvm/ffi/c_api.h
index b0ce3c1..e988e24 100644
--- a/include/tvm/ffi/c_api.h
+++ b/include/tvm/ffi/c_api.h
@@ -233,7 +233,9 @@ typedef struct {
uint32_t weak_ref_count;
/*! \brief Strong reference counter of the object. */
uint64_t strong_ref_count;
+#if !defined(TVM_FFI_DOXYGEN_MODE)
union {
+#endif
/*!
* \brief Deleter to be invoked when strong reference counter goes to zero.
* \param self The self object handle.
@@ -246,7 +248,9 @@ typedef struct {
* \note This helps us to ensure cross platform compatibility.
*/
int64_t __ensure_align;
+#if !defined(TVM_FFI_DOXYGEN_MODE)
};
+#endif
} TVMFFIObject;
/*!
@@ -261,7 +265,9 @@ typedef struct {
* \note The type index of Object and Any are shared in FFI.
*/
int32_t type_index;
+#if !defined(TVM_FFI_DOXYGEN_MODE)
union { // 4 bytes
+#endif
/*! \brief padding, must set to zero for values other than small string. */
uint32_t zero_padding;
/*!
@@ -271,18 +277,33 @@ typedef struct {
* when accessing the small str content.
*/
uint32_t small_str_len;
+#if !defined(TVM_FFI_DOXYGEN_MODE)
};
- union { // 8 bytes
- int64_t v_int64; // integers
- double v_float64; // floating-point numbers
- void* v_ptr; // typeless pointers
- const char* v_c_str; // raw C-string
- TVMFFIObject* v_obj; // ref counted objects
- DLDataType v_dtype; // data type
- DLDevice v_device; // device
- char v_bytes[8]; // small string
- uint64_t v_uint64; // uint64 repr mainly used for hashing
+#endif
+#if !defined(TVM_FFI_DOXYGEN_MODE)
+ union { // 8 bytes
+#endif
+ /*! \brief integers */
+ int64_t v_int64;
+ /*! \brief floating-point numbers */
+ double v_float64;
+ /*! \brief typeless pointers */
+ void* v_ptr;
+ /*! \brief raw C-string */
+ const char* v_c_str;
+ /*! \brief ref counted objects */
+ TVMFFIObject* v_obj;
+ /*! \brief data type */
+ DLDataType v_dtype;
+ /*! \brief device */
+ DLDevice v_device;
+ /*! \brief small string */
+ char v_bytes[8];
+ /*! \brief uint64 repr mainly used for hashing */
+ uint64_t v_uint64;
+#if !defined(TVM_FFI_DOXYGEN_MODE)
};
+#endif
} TVMFFIAny;
/*!
diff --git a/include/tvm/ffi/container/map.h b/include/tvm/ffi/container/map.h
index 4719045..df41d3f 100644
--- a/include/tvm/ffi/container/map.h
+++ b/include/tvm/ffi/container/map.h
@@ -1357,8 +1357,14 @@ inline void MapObj::InsertMaybeReHash(KVType&& kv,
ObjectPtr<Object>* map) {
}
}
+/// \cond Doxygen_Suppress
+/*!
+ * \brief Specialize make_object<MapObj> to be deleted for
make_object<DenseMapObj> and
+ * make_object<SmallMapObj> only.
+ */
template <>
inline ObjectPtr<MapObj> make_object<>() = delete;
+/// \endcond
/*!
* \brief Map container of NodeRef->NodeRef in DSL graph.
diff --git a/include/tvm/ffi/container/tensor.h
b/include/tvm/ffi/container/tensor.h
index 1e251b0..9f698de 100644
--- a/include/tvm/ffi/container/tensor.h
+++ b/include/tvm/ffi/container/tensor.h
@@ -218,7 +218,6 @@ class TensorObj : public Object, public DLTensor {
}
friend class Tensor;
- /// \endcond
};
namespace details {
diff --git a/include/tvm/ffi/reflection/access_path.h
b/include/tvm/ffi/reflection/access_path.h
index ea102e1..e728499 100644
--- a/include/tvm/ffi/reflection/access_path.h
+++ b/include/tvm/ffi/reflection/access_path.h
@@ -108,7 +108,6 @@ class AccessStep : public ObjectRef {
* \brief Constructor
* \param kind The kind of the access step.
* \param key The key of the access step.
- * \return The access step.
*/
AccessStep(AccessKind kind, Any key) :
ObjectRef(make_object<AccessStepObj>(kind, key)) {}
diff --git a/include/tvm/ffi/reflection/registry.h
b/include/tvm/ffi/reflection/registry.h
index f72fd3c..e989530 100644
--- a/include/tvm/ffi/reflection/registry.h
+++ b/include/tvm/ffi/reflection/registry.h
@@ -73,10 +73,7 @@ class AttachFieldFlag : public FieldInfoTrait {
public:
/*!
* \brief Attach a field flag to the field
- *
* \param flag The flag to be set
- *
- * \return The trait object.
*/
explicit AttachFieldFlag(int32_t flag) : flag_(flag) {}
@@ -580,6 +577,7 @@ inline void EnsureTypeAttrColumn(std::string_view name) {
* };
* refl::ObjectDef<ExampleObject>()
* .def_static("__init__", refl::init<ExampleObject, int64_t, int32_t>);
+ * \endcode
*/
template <typename T, typename... Args>
inline ObjectRef init(Args&&... args) {