This is an automated email from the ASF dual-hosted git repository.

tqchen pushed a commit to branch refactor-s2
in repository https://gitbox.apache.org/repos/asf/tvm.git

commit db39ea353807c8eb28b3420b7ff7262fcc626c8f
Author: tqchen <[email protected]>
AuthorDate: Sat May 3 09:09:33 2025 -0400

    [FFI] Unify notable object cell naming
---
 ffi/include/tvm/ffi/c_api.h           | 20 ++++++++++----------
 ffi/include/tvm/ffi/container/shape.h |  2 +-
 ffi/include/tvm/ffi/error.h           |  2 +-
 python/tvm/ffi/cython/base.pxi        |  8 ++++----
 python/tvm/ffi/cython/error.pxi       |  6 +++---
 python/tvm/ffi/cython/ndarray.pxi     |  2 +-
 6 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/ffi/include/tvm/ffi/c_api.h b/ffi/include/tvm/ffi/c_api.h
index c2bc31f0a0..f1f5f2f049 100644
--- a/ffi/include/tvm/ffi/c_api.h
+++ b/ffi/include/tvm/ffi/c_api.h
@@ -205,15 +205,15 @@ typedef struct {
 } TVMFFIByteArray;
 
 /*!
- * \brief Shape array used in shape object following header.
+ * \brief Shape cell used in shape object following header.
  */
 typedef struct {
   const int64_t* data;
   size_t size;
-} TVMFFIShapeArray;
+} TVMFFIShapeCell;
 
 /*!
- * \brief Method information that can appear in reflection table.
+ * \brief Error cell used in error object following header.
  */
 typedef struct {
   /*! \brief The kind of the error. */
@@ -224,7 +224,7 @@ typedef struct {
    * \brief The traceback of the error.
    */
   const char* traceback;
-} TVMFFIErrorInfo;
+} TVMFFIErrorCell;
 
 /*!
  * \brief Type that defines C-style safe call convention
@@ -262,7 +262,7 @@ typedef int (*TVMFFISafeCallType)(void* self, const 
TVMFFIAny* args, int32_t num
                                   TVMFFIAny* result);
 
 /*!
- * \brief Object cell for function object.
+ * \brief Object cell for function object following header.
  */
 typedef struct {
   /*! \brief A C API compatible call with exception catching. */
@@ -670,8 +670,8 @@ inline TVMFFIByteArray* 
TVMFFIBytesGetByteArrayPtr(TVMFFIObjectHandle obj) {
  * \param obj The object handle.
  * \return The data pointer.
  */
-inline TVMFFIErrorInfo* TVMFFIErrorGetErrorInfoPtr(TVMFFIObjectHandle obj) {
-  return reinterpret_cast<TVMFFIErrorInfo*>(reinterpret_cast<char*>(obj) + 
sizeof(TVMFFIObject));
+inline TVMFFIErrorCell* TVMFFIErrorGetCellPtr(TVMFFIObjectHandle obj) {
+  return reinterpret_cast<TVMFFIErrorCell*>(reinterpret_cast<char*>(obj) + 
sizeof(TVMFFIObject));
 }
 
 /*!
@@ -679,7 +679,7 @@ inline TVMFFIErrorInfo* 
TVMFFIErrorGetErrorInfoPtr(TVMFFIObjectHandle obj) {
  * \param obj The object handle.
  * \return The data pointer.
  */
-inline TVMFFIFunctionCell* TVMFFIFunctionGetFunctionCellPtr(TVMFFIObjectHandle 
obj) {
+inline TVMFFIFunctionCell* TVMFFIFunctionGetCellPtr(TVMFFIObjectHandle obj) {
   return reinterpret_cast<TVMFFIFunctionCell*>(reinterpret_cast<char*>(obj) + 
sizeof(TVMFFIObject));
 }
 
@@ -688,8 +688,8 @@ inline TVMFFIFunctionCell* 
TVMFFIFunctionGetFunctionCellPtr(TVMFFIObjectHandle o
  * \param obj The object handle.
  * \return The data pointer.
  */
-inline TVMFFIShapeArray* TVMFFIShapeGetShapeArrayPtr(TVMFFIObjectHandle obj) {
-  return reinterpret_cast<TVMFFIShapeArray*>(reinterpret_cast<char*>(obj) + 
sizeof(TVMFFIObject));
+inline TVMFFIShapeCell* TVMFFIShapeGetCellPtr(TVMFFIObjectHandle obj) {
+  return reinterpret_cast<TVMFFIShapeCell*>(reinterpret_cast<char*>(obj) + 
sizeof(TVMFFIObject));
 }
 
 /*!
diff --git a/ffi/include/tvm/ffi/container/shape.h 
b/ffi/include/tvm/ffi/container/shape.h
index 6681d1b2df..7c4839d226 100644
--- a/ffi/include/tvm/ffi/container/shape.h
+++ b/ffi/include/tvm/ffi/container/shape.h
@@ -37,7 +37,7 @@ namespace tvm {
 namespace ffi {
 
 /*! \brief An object representing a shape tuple. */
-class ShapeObj : public Object, public TVMFFIShapeArray {
+class ShapeObj : public Object, public TVMFFIShapeCell {
  public:
   using index_type = int64_t;
 
diff --git a/ffi/include/tvm/ffi/error.h b/ffi/include/tvm/ffi/error.h
index 4e8603a5e3..a07b66cd8d 100644
--- a/ffi/include/tvm/ffi/error.h
+++ b/ffi/include/tvm/ffi/error.h
@@ -78,7 +78,7 @@ struct EnvErrorAlreadySet : public std::exception {};
 /*!
  * \brief Error object class.
  */
-class ErrorObj : public Object, public TVMFFIErrorInfo {
+class ErrorObj : public Object, public TVMFFIErrorCell {
  public:
   /*!
    * \brief Update the traceback of the error object.
diff --git a/python/tvm/ffi/cython/base.pxi b/python/tvm/ffi/cython/base.pxi
index 21be77e86f..5c04e3316a 100644
--- a/python/tvm/ffi/cython/base.pxi
+++ b/python/tvm/ffi/cython/base.pxi
@@ -120,11 +120,11 @@ cdef extern from "tvm/ffi/c_api.h":
         const char* data
         size_t size
 
-    ctypedef struct TVMFFIShapeArray:
+    ctypedef struct TVMFFIShapeCell:
         const int64_t* data
         size_t size
 
-    ctypedef struct TVMFFIErrorInfo:
+    ctypedef struct TVMFFIErrorCell:
         const char* kind
         const char* message
         const char* traceback
@@ -163,8 +163,8 @@ cdef extern from "tvm/ffi/c_api.h":
     int TVMFFINDArrayToDLPackVersioned(TVMFFIObjectHandle src,
                                         DLManagedTensorVersioned** out) nogil
     TVMFFIByteArray* TVMFFIBytesGetByteArrayPtr(TVMFFIObjectHandle obj) nogil
-    TVMFFIErrorInfo* TVMFFIErrorGetErrorInfoPtr(TVMFFIObjectHandle obj) nogil
-    TVMFFIShapeArray* TVMFFIShapeGetShapeArrayPtr(TVMFFIObjectHandle obj) nogil
+    TVMFFIErrorCell* TVMFFIErrorGetCellPtr(TVMFFIObjectHandle obj) nogil
+    TVMFFIShapeCell* TVMFFIShapeGetCellPtr(TVMFFIObjectHandle obj) nogil
     DLTensor* TVMFFINDArrayGetDLTensorPtr(TVMFFIObjectHandle obj) nogil
     DLDevice TVMFFIDLDeviceFromIntPair(int32_t device_type, int32_t device_id) 
nogil
 
diff --git a/python/tvm/ffi/cython/error.pxi b/python/tvm/ffi/cython/error.pxi
index 4a1528075e..ba1d930912 100644
--- a/python/tvm/ffi/cython/error.pxi
+++ b/python/tvm/ffi/cython/error.pxi
@@ -100,15 +100,15 @@ cdef class Error(Object):
 
     @property
     def kind(self):
-        return py_str(TVMFFIErrorGetErrorInfoPtr(self.chandle).kind)
+        return py_str(TVMFFIErrorGetCellPtr(self.chandle).kind)
 
     @property
     def message(self):
-        return py_str(TVMFFIErrorGetErrorInfoPtr(self.chandle).message)
+        return py_str(TVMFFIErrorGetCellPtr(self.chandle).message)
 
     @property
     def traceback(self):
-        return py_str(TVMFFIErrorGetErrorInfoPtr(self.chandle).traceback)
+        return py_str(TVMFFIErrorGetCellPtr(self.chandle).traceback)
 
 _register_object_by_index(kTVMFFIError, Error)
 
diff --git a/python/tvm/ffi/cython/ndarray.pxi 
b/python/tvm/ffi/cython/ndarray.pxi
index 3e0014da63..86f9014dc2 100644
--- a/python/tvm/ffi/cython/ndarray.pxi
+++ b/python/tvm/ffi/cython/ndarray.pxi
@@ -151,7 +151,7 @@ def from_dlpack(ext_tensor, *, required_alignment=8, 
required_contiguous=True):
 
 # helper class for shape handling
 def _shape_obj_get_py_tuple(obj):
-    cdef TVMFFIShapeArray* shape = 
TVMFFIShapeGetShapeArrayPtr((<Object>obj).chandle)
+    cdef TVMFFIShapeCell* shape = TVMFFIShapeGetCellPtr((<Object>obj).chandle)
     return tuple(shape.data[i] for i in range(shape.size))
 
 

Reply via email to