Halide icon indicating copy to clipboard operation
Halide copied to clipboard

Python bindings should preserve float32 scalar Exprs

Open steven-johnson opened this issue 1 year ago • 4 comments

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

steven-johnson avatar Sep 16 '24 18:09 steven-johnson

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

runenordmo avatar Sep 16 '24 18:09 runenordmo

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.

steven-johnson avatar Sep 17 '24 22:09 steven-johnson

@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.

dragly avatar Sep 18 '24 17:09 dragly

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.

steven-johnson avatar Sep 18 '24 20:09 steven-johnson