tlc-pack / relax

Apache License 2.0
193 stars 58 forks source link

[Op] Use int64 IntImms as static shape-related attributes #359

Closed MasterJH5574 closed 1 year ago

MasterJH5574 commented 1 year ago

This PR introduces the conversion for shape-related static integer op attributes.

Currently in Relax the default integer dtype for shape-related values is int64, while TVM FFI’s default dtype for integers is int32. This means when our TVMScript parser parsing an integer attribute of a operator, the parsed dtype will be int32, the default integer dtype of FFI.

However, for shape-related attributes we hope them to have int64 dtype. Therefore, this PR will actively converts them to int64 upon construction of op calls. To simplify the conversion, we change the type of these values from Integer to IntImm.

We add regression tests to make sure that these fields are indeed int64 after parsing.

MasterJH5574 commented 1 year ago

Dependency cleared. Depends on #358 since both are changing conv2d and max_pool2d.