Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deprecated JIT handler setters #6699

Merged
merged 1 commit into from
Apr 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 0 additions & 27 deletions src/Func.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3309,33 +3309,6 @@ void set_handler(A &a, B b) {
}
} // namespace

// Deprecated setters for JIT handlers
void Func::set_error_handler(void (*handler)(void *, const char *)) {
set_handler(jit_handlers().custom_error, handler);
}

void Func::set_custom_allocator(void *(*cust_malloc)(void *, size_t),
void (*cust_free)(void *, void *)) {
set_handler(jit_handlers().custom_malloc, cust_malloc);
set_handler(jit_handlers().custom_free, cust_free);
}

void Func::set_custom_do_par_for(int (*cust_do_par_for)(void *, int (*)(void *, int, uint8_t *), int, int, uint8_t *)) {
set_handler(jit_handlers().custom_do_par_for, cust_do_par_for);
}

void Func::set_custom_do_task(int (*cust_do_task)(void *, int (*)(void *, int, uint8_t *), int, uint8_t *)) {
set_handler(jit_handlers().custom_do_task, cust_do_task);
}

void Func::set_custom_trace(int (*trace_fn)(void *, const halide_trace_event_t *)) {
set_handler(jit_handlers().custom_trace, trace_fn);
}

void Func::set_custom_print(void (*cust_print)(void *, const char *)) {
set_handler(jit_handlers().custom_print, cust_print);
}

void Func::add_custom_lowering_pass(IRMutator *pass, std::function<void()> deleter) {
pipeline().add_custom_lowering_pass(pass, std::move(deleter));
}
Expand Down
23 changes: 0 additions & 23 deletions src/Func.h
Original file line number Diff line number Diff line change
Expand Up @@ -1053,29 +1053,6 @@ class Func {
*/
void compile_jit(const Target &target = get_jit_target_from_environment());

/** Deprecated variants of the above that use a void pointer
* instead of a JITUserContext pointer. */
// @{
HALIDE_ATTRIBUTE_DEPRECATED("Custom handlers should by set by modifying the struct returned by jit_handlers()")
void set_error_handler(void (*handler)(void *, const char *));
HALIDE_ATTRIBUTE_DEPRECATED("Custom handlers should by set by modifying the struct returned by jit_handlers()")
void set_custom_allocator(void *(*malloc)(void *, size_t),
void (*free)(void *, void *));
HALIDE_ATTRIBUTE_DEPRECATED("Custom handlers should by set by modifying the struct returned by jit_handlers()")
void set_custom_do_task(
int (*custom_do_task)(void *, int (*)(void *, int, uint8_t *),
int, uint8_t *));
HALIDE_ATTRIBUTE_DEPRECATED("Custom handlers should by set by modifying the struct returned by jit_handlers()")
void set_custom_do_par_for(
int (*custom_do_par_for)(void *, int (*)(void *, int, uint8_t *), int,
int, uint8_t *));
HALIDE_ATTRIBUTE_DEPRECATED("Custom handlers should by set by modifying the struct returned by jit_handlers()")
void set_custom_trace(int (*trace_fn)(void *, const halide_trace_event_t *));

HALIDE_ATTRIBUTE_DEPRECATED("Custom handlers should by set by modifying the struct returned by jit_handlers()")
void set_custom_print(void (*handler)(void *, const char *));
// @}

/** Get a struct containing the currently set custom functions
* used by JIT. This can be mutated. Changes will take effect the
* next time this Func is realized. */
Expand Down
37 changes: 0 additions & 37 deletions src/Pipeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -640,43 +640,6 @@ void Pipeline::compile_jit(const Target &target_arg) {
contents->jit_module = jit_module;
}

template<typename A, typename B>
void set_handler(A &a, B b) {
a = (A)b;
}

void Pipeline::set_error_handler(void (*handler)(void *, const char *)) {
user_assert(defined()) << "Pipeline is undefined\n";
set_handler(contents->jit_handlers.custom_error, handler);
}

void Pipeline::set_custom_allocator(void *(*cust_malloc)(void *, size_t),
void (*cust_free)(void *, void *)) {
user_assert(defined()) << "Pipeline is undefined\n";
set_handler(contents->jit_handlers.custom_malloc, cust_malloc);
set_handler(contents->jit_handlers.custom_free, cust_free);
}

void Pipeline::set_custom_do_par_for(int (*cust_do_par_for)(void *, int (*)(void *, int, uint8_t *), int, int, uint8_t *)) {
user_assert(defined()) << "Pipeline is undefined\n";
set_handler(contents->jit_handlers.custom_do_par_for, cust_do_par_for);
}

void Pipeline::set_custom_do_task(int (*cust_do_task)(void *, int (*)(void *, int, uint8_t *), int, uint8_t *)) {
user_assert(defined()) << "Pipeline is undefined\n";
set_handler(contents->jit_handlers.custom_do_task, cust_do_task);
}

void Pipeline::set_custom_trace(int (*trace_fn)(void *, const halide_trace_event_t *)) {
user_assert(defined()) << "Pipeline is undefined\n";
set_handler(contents->jit_handlers.custom_trace, trace_fn);
}

void Pipeline::set_custom_print(void (*cust_print)(void *, const char *)) {
user_assert(defined()) << "Pipeline is undefined\n";
set_handler(contents->jit_handlers.custom_print, cust_print);
}

void Pipeline::set_jit_externs(const std::map<std::string, JITExtern> &externs) {
user_assert(defined()) << "Pipeline is undefined\n";
contents->jit_externs = externs;
Expand Down
22 changes: 0 additions & 22 deletions src/Pipeline.h
Original file line number Diff line number Diff line change
Expand Up @@ -349,28 +349,6 @@ class Pipeline {
*/
void compile_jit(const Target &target = get_jit_target_from_environment());

/** Deprecated variants of the above that use a void pointer
* instead of a JITUserContext pointer. */
// @{
HALIDE_ATTRIBUTE_DEPRECATED("Custom handlers should by set by modifying the struct returned by jit_handlers()")
void set_error_handler(void (*handler)(void *, const char *));
HALIDE_ATTRIBUTE_DEPRECATED("Custom handlers should by set by modifying the struct returned by jit_handlers()")
void set_custom_allocator(void *(*malloc)(void *, size_t),
void (*free)(void *, void *));
HALIDE_ATTRIBUTE_DEPRECATED("Custom handlers should by set by modifying the struct returned by jit_handlers()")
void set_custom_do_task(
int (*custom_do_task)(void *, int (*)(void *, int, uint8_t *),
int, uint8_t *));
HALIDE_ATTRIBUTE_DEPRECATED("Custom handlers should by set by modifying the struct returned by jit_handlers()")
void set_custom_do_par_for(
int (*custom_do_par_for)(void *, int (*)(void *, int, uint8_t *), int,
int, uint8_t *));
HALIDE_ATTRIBUTE_DEPRECATED("Custom handlers should by set by modifying the struct returned by jit_handlers()")
void set_custom_trace(int (*trace_fn)(void *, const halide_trace_event_t *));
HALIDE_ATTRIBUTE_DEPRECATED("Custom handlers should by set by modifying the struct returned by jit_handlers()")
void set_custom_print(void (*handler)(void *, const char *));
// @}

/** Install a set of external C functions or Funcs to satisfy
* dependencies introduced by HalideExtern and define_extern
* mechanisms. These will be used by calls to realize,
Expand Down