Skip to content

Conversation

@Lunderberg
Copy link
Contributor

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 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 `PrimFunc`s, 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.
@tqchen tqchen merged commit f6fe2aa into apache:main Jun 18, 2024
@Lunderberg Lunderberg deleted the bugfix_call_rpc_function_with_zero_args branch June 18, 2024 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants