slyubomirsky commented on code in PR #16183:
URL: https://github.com/apache/tvm/pull/16183#discussion_r1409766490
##########
include/tvm/runtime/packed_func.h:
##########
@@ -1996,8 +2123,10 @@ inline TObjectRef TVMPODValue_::AsObjectRef() const {
<< "Expect a not null value of " << ContainerType::_type_key;
return TObjectRef(ObjectPtr<Object>(nullptr));
}
- // NOTE: the following code can be optimized by constant folding.
- if (std::is_base_of<NDArray::ContainerType, ContainerType>::value) {
+
+ // NOTE: The following code uses "if constexpr" wherever possible to
+ // minimize the number of runtime checks.
Review Comment:
Sometimes I love modern C++ :slightly_smiling_face:
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]