halide / Halide

a language for fast, portable data-parallel computation
https://halide-lang.org
Other
5.91k stars 1.07k forks source link

Python bindings should preserve float32 scalar Exprs #8420

Open steven-johnson opened 2 months ago

steven-johnson commented 2 months ago

Tweak the PyBind11 code so that float32 scalars created via numpy.float32() don't get converted into boolean expressions.

@runenordmo @dragly Please try this out with your local codebases and let me know if it solves the problem (and/or doesn't introduce new, worse problems) -- I don't want to land this without your feedback.

Fixes #8414

runenordmo commented 2 months ago

Thanks for looking at this, @steven-johnson 👍 We'll try in our code base and look at the changes tomorrow

steven-johnson commented 2 months ago

EDIT: looks like this fix is somewhat nondeterministic -- it fails for at least two targets for no obvious reason I can tell. I'll have to do some more debugging on this before it can land, but it's clearly not right as-is.

dragly commented 2 months ago

@steven-johnson it took a bit more time for us to get this tested (we are on a fork of an old Halide release, but backporting the change was no problem). We have run the new version on our end now and it fixes the problem. All tests are, so it seems to be okay in our code.

Let us know if you want to test again with a new version that has the necessary changes to pass your tests too.

steven-johnson commented 2 months ago

Yeah, this fix is nondeterministic (by compiler/OS/etc) so it makes me too nervous to land. I don't have a better fix yet and I'm off the rest of the week so a better fix might not be on the way right now.