apivovarov edited a comment on pull request #7605:
URL: https://github.com/apache/tvm/pull/7605#issuecomment-793081233


   I checked all Save/Load methods. 
   `size_t` was used only for Constants (fixed)
   
   After this fix we use the following types in each method:
   - Header - uint64_t, string
   - GlobalSection - string
   - ConstantSection - number of constants - uint64_t, NDArray (see below) and 
const_device_type - uint64_t (was size_t before).
   - PrimitiveOpNames - string
   - CodeSection:  number of functions - uint64_t, functions - string, 
instructions - uint64_t
   
   During  NDArray serialization we write the following to the Stream:
   - cpu_ctx: DLContext - int device_type, int device_id (`int` is 4 bytes on 
32 and 64 bit platforms. On 16-bit platforms it can be 2 bytes)
   - dtype: DLDataType - uint8_t code, uint8_t bits, uint16_t lanes
   - int ndim (usually 4 bytes), int64_t* shape, data void* (data_byte_size 
calculation is platform independent = uint8_t bits * int64_t num_elems)
   
   We should probably use `int32_t` instead of `int` during the serialization 
(DLContext and ndim).
   `int` is 2 bytes on 16-bit OS (such as Arduino Uno). Lets make fixes for 
16-bit OS in a separate PR (Not sure if TVM supports 16-bit platforms at all).
      


----------------------------------------------------------------
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.

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


Reply via email to