Skip to content

Commit

Permalink
[FFI] Remove backwards-compatibility unwrapping of IntImm
Browse files Browse the repository at this point in the history
This is a follow-up PR to apache#16183,
which updated the FFI with explicit integer types.  As part of that
change, many internal functions were updated to accept non-IR
types (e.g. `Array<runtime::Int>` instead of `Array<IntImm>`).  For
backwards compatibility with callees that provided the IR types, a
specialization of `PackedFuncValueConverter` unwrapped the `IntImm`
into a `runtime::Int`.

This commit removes the backwards-compatibility specialization of
`PackedFuncValueConverter`.  Breakages that are found in CI as a
result will then be updated at the caller side, removing the need for
the backwards-compatibility handler altogether.
  • Loading branch information
Lunderberg committed Aug 26, 2024
1 parent c4acc79 commit c55d87c
Showing 1 changed file with 0 additions and 22 deletions.
22 changes: 0 additions & 22 deletions include/tvm/ir/expr.h
Original file line number Diff line number Diff line change
Expand Up @@ -866,28 +866,6 @@ struct PackedFuncValueConverter<tvm::FloatImm> {
}
};

/* \brief Backwards compatibility wrapper for IntImm arguments
*
* In previous versions of TVM, IntImm was the default FFI type for
* integer arguments, instead of runtime::Int. For backwards
* compatibility where the callee has been updated to expected a
* runtime::Int, the caller has not been updated to provide a
* runtime::Int (e.g. relay script parsing), and the auto-unboxing of
* runtime::Int does not apply (e.g. making an `Array<runtime::Int>`),
* allow the IntImm to be generated.
*/
template <>
struct PackedFuncValueConverter<runtime::Int> {
template <typename PODSubclass>
static runtime::Int From(const PODSubclass& val) {
if (val.template IsObjectRef<tvm::IntImm>()) {
return runtime::Int(val.template AsObjectRef<tvm::IntImm>()->value);
} else {
return val.template AsObjectRef<runtime::Int>();
}
}
};

} // namespace runtime
} // namespace tvm

Expand Down

0 comments on commit c55d87c

Please sign in to comment.