The PackedFunc interface has arguments int num_args and TVMValue* args, which contain the number of arguments and a pointer to the array of arguments. Prior to this commit, when implementing the PackedFunc interface for TIR PrimFuncs, the MakePackedAPI pass would always assert that the args pointer was not null. However, the args pointer is allowed to be null if num_args is zero. For example, this occurs when calling an RPC function with no arguments.
This commit updates the MakePackedAPI transform to only assert that args is non-null when num_args is greater than zero.
The
PackedFunc
interface has argumentsint num_args
andTVMValue* args
, which contain the number of arguments and a pointer to the array of arguments. Prior to this commit, when implementing thePackedFunc
interface for TIRPrimFunc
s, theMakePackedAPI
pass would always assert that theargs
pointer was not null. However, theargs
pointer is allowed to be null ifnum_args
is zero. For example, this occurs when calling an RPC function with no arguments.This commit updates the
MakePackedAPI
transform to only assert thatargs
is non-null whennum_args
is greater than zero.