Skip to content

Commit

Permalink
Make Callable::call_argv_fast public (#7315)
Browse files Browse the repository at this point in the history
* Make Callable::call_argv_fast public

* Add rough specification of the calling convention

* Fix a typo
  • Loading branch information
twesterhout authored Feb 1, 2023
1 parent beba53a commit 0782d80
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/Callable.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<int(JITUserContext *)>;

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 0782d80

Please sign in to comment.