apivovarov commented 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 some exotic platforms it can be 16 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).
It is difficult to find such a device where `int` is 16 bits. Lets make this
improvement in a separate PR with lower priority.
----------------------------------------------------------------
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]