apache / tvm

Open deep learning compiler stack for cpu, gpu and specialized accelerators
https://tvm.apache.org/
Apache License 2.0
11.61k stars 3.44k forks source link

[TIR][RPC] Allow RPC calls to compiled PrimFuncs with no arguments #17098

Closed Lunderberg closed 3 months ago

Lunderberg commented 3 months ago

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.