Lunderberg commented on PR #17103:
URL: https://github.com/apache/tvm/pull/17103#issuecomment-2176655778

   > Object system is not necessarily tied to c++ from the ABI level 
   
   The Object base class uses `std::atomic<int32_t>` to store the reference 
count.  This is an opaque type, and is not guaranteed to have an internal 
`int32_t`.  In C++23, the `_Atomic` macro was introduced to `stdatomic.h` which 
could make an equivalent declaration in C, but it is still not guaranteed to 
have an internal `int32_t`.  The ABI is tied to C++.
   
   > Seems returning a string is more advanced feature that we still would want 
to be careful with, so maybe we don't have to strictly enable it in pure C 
backend.
   
   Operations that are difficult to write for a C backend will also be 
difficult to write in the LLVM codegen.  The main difficulty is due to the 
current use of a C++ type `std::string` to store a returned string value.
   
   > the main complexity here is that the return value container is adding more 
complexity that already is part of object system
   
   I suppose we could strip out `TVMRetValue` entirely and return a `Object*` 
directly, but that seems like a far more wide-reaching change.  Since we 
already had the distinction between `TVMRetValue` (directly contains primitive 
types for ease of ABI) and `Object*`, I thought it best to preserve that 
distinction.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to