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 ParamMap (Fix #7121) #7355

Closed
wants to merge 3 commits into from
Closed

Remove ParamMap (Fix #7121) #7355

wants to merge 3 commits into from

Conversation

steven-johnson
Copy link
Contributor

This PR proposes to remove ParamMap entirely for Halide 16; it was added to provide a threadsafe way to provide parameteres to the JIT, but compile_to_callable() now does this in a much less intrusive way.

Normally I'd propose deprecating something like this first (eg via ifdef), but in this case it would be extremely intrusive to do so, so this PR just rips off the band-aid and removes it entirely -- feedback welcome on this.

This PR proposes to remove ParamMap entirely for Halide 16; it was added to provide a threadsafe way to provide parameteres to the JIT, but `compile_to_callable()` now does this in a much less intrusive way.

Normally I'd propose deprecating something like this first (eg via ifdef), but in this case it would be extremely intrusive to do so, so this PR just rips off the band-aid and removes it entirely -- feedback welcome on this.
@steven-johnson steven-johnson added the release_notes For changes that may warrant a note in README for official releases. label Feb 15, 2023
@@ -12,11 +12,15 @@
using namespace Halide;
using namespace Halide::Tools;

// The Halide compiler is currently not guaranteed to be thread safe.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not? I thought we fixed all the non-threadsafe stuff a long time ago.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sadly, no -- we had several tests that were multithreaded (eg simd_op_check) and had to remove all of that because of thread safety issues (e.g. Parameters being used across multiple threads) -- if it's threadsafe now then we don't have any tests that verify this via torture

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be fine if no Halide objects are shared across threads. I.e. we don't have any non-threadsafe hidden global state (though temporaries will get non-deterministic names due to atomic counters used to name them).

But yeah the individual objects may have non-threadsafe state, so if you share Halide objects across threads and mutate them bad things will happen.

@abadams
Copy link
Member

abadams commented Feb 15, 2023

Sure maybe an ifdef is a pain, but can't we mark all the ParamMap-consuming methods with deprecation warnings for a version before ripping them out?

@steven-johnson
Copy link
Contributor Author

can't we mark all the ParamMap-consuming methods with deprecation warnings for a version before ripping them out

I guess we could, we'd just have to introduce new overloads for all of them (basically doubling the number of overloads to realize() and infer_input_bounds()), otherwise you'd get deprecation warnings all over the place.

IIRC we know of exactly one user for ParamMap in the first place -- we should contact them specifically and get their feedback.

@abadams
Copy link
Member

abadams commented Feb 15, 2023

What about adding a deprecation warning to all ParamMap methods except for empty_map() and the default constructor?

@steven-johnson
Copy link
Contributor Author

What about adding a deprecation warning to all ParamMap methods except for empty_map() and the default constructor?

Looks promising, see #7357

@steven-johnson
Copy link
Contributor Author

Closing this in favor of #7357

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release_notes For changes that may warrant a note in README for official releases.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants