From 0782d80b4907f94b4bc2b0df806306952ad39111 Mon Sep 17 00:00:00 2001 From: Tom Westerhout <14264576+twesterhout@users.noreply.github.com> Date: Wed, 1 Feb 2023 18:24:01 +0000 Subject: [PATCH] Make Callable::call_argv_fast public (#7315) * Make Callable::call_argv_fast public * Add rough specification of the calling convention * Fix a typo --- src/Callable.h | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/Callable.h b/src/Callable.h index 440ba3aab21d..4eb03e1f1ea2 100644 --- a/src/Callable.h +++ b/src/Callable.h @@ -281,7 +281,6 @@ class Callable { // Note that the first entry in argv must always be a JITUserContext*. int call_argv_checked(size_t argc, const void *const *argv, const QuickCallCheckInfo *actual_cci) const; - int call_argv_fast(size_t argc, const void *const *argv) const; using FailureFn = std::function; @@ -380,6 +379,24 @@ class Callable { }; } } + + /** Unsafe low-overhead way of invoking the Callable. + * + * This function relies on the same calling convention as the argv-based + * functions generated for ahead-of-time compiled Halide pilelines. + * + * Very rough specifications of the calling convention (but check the source + * code to be sure): + * + * * Arguments are passed in the same order as they appear in the C + * function argument list. + * * The first entry in argv must always be a JITUserContext*. Please, + * note that this means that argv[0] actually contains JITUserContext**. + * * All scalar arguments are passed by pointer, not by value, regardless of size. + * * All buffer arguments (input or output) are passed as halide_buffer_t*. + * + */ + int call_argv_fast(size_t argc, const void *const *argv) const; }; } // namespace Halide