Glow: [cross platform] 'size_t' in struct BundleConfig may cause platform mismatch

Created on 26 Mar 2019  路  2Comments  路  Source: pytorch/glow

hi,
I am tring Ahead-of-time Compilation example : resnet50.

function 'emitBundleConfig' emit BundleConfig struct, and there are many 'size_t' member. it may cause some problem when cross platform :

while build a 32-bit binary on 64-bit, (for example build armv7 binary on x86_64 ubuntu). emit resnet50.o's size_t is 64-bit, but main.cpp.o's size_t is 32-bit (which is compiled by arm compiler).

so, is it OK to modify BundleConfig's size_t to be 'uint64_t'; Or modify function 'emitBundleConfig' to emit different 'size_t', according to the target's size_t.

Most helpful comment

@xizhizhang Good catch! Thanks!

so, is it OK to modify BundleConfig's size_t to be 'uint64_t'; Or modify function 'emitBundleConfig' to emit different 'size_t', according to the target's size_t.

Yes, I think we should use uint64_t instead of size_t for the fields of BundleConfig. We should update emitBundleConfig and examples reading BundleConfig accordingly.

Are you interested in submitting a PR for this change?

All 2 comments

@xizhizhang Good catch! Thanks!

so, is it OK to modify BundleConfig's size_t to be 'uint64_t'; Or modify function 'emitBundleConfig' to emit different 'size_t', according to the target's size_t.

Yes, I think we should use uint64_t instead of size_t for the fields of BundleConfig. We should update emitBundleConfig and examples reading BundleConfig accordingly.

Are you interested in submitting a PR for this change?

@xizhizhang Good catch! Thanks!

so, is it OK to modify BundleConfig's size_t to be 'uint64_t'; Or modify function 'emitBundleConfig' to emit different 'size_t', according to the target's size_t.

Yes, I think we should use uint64_t instead of size_t for the fields of BundleConfig. We should update emitBundleConfig and examples reading BundleConfig accordingly.

Are you interested in submitting a PR for this change?

yeah, I may submit it at the following weekend.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

s-peryt picture s-peryt  路  3Comments

rdzhabarov picture rdzhabarov  路  4Comments

wayneshawn picture wayneshawn  路  3Comments

opti-mix picture opti-mix  路  4Comments

dati91 picture dati91  路  3Comments