Skip to content

Conversation

@alexreinking
Copy link
Member

@alexreinking alexreinking commented Aug 19, 2025

I finally audited the IROperator.h header and added the missing Python bindings here.

I also corrected an apparently inadvertent overload to the normal hl.atan function that allowed it to behave like hl.atan2 when supplied two arguments. This wasn't tested anywhere in the bindings, so I don't know who this will frustrate. But neither the Python math.atan nor Numpy's np.atan support such an overload.

I opened #8770 to track the fact that this PR is also missing tests. I want to get this in sooner rather than later to unblock @rtzam.

Fixes #8751
Fixes #8769

@alexreinking alexreinking added the python Issues related to Halide/Python interop label Aug 19, 2025
Different clang-format versions want to format the C-style
cast differently. This is annoying.

Add some blank lines for visual flow.
static_cast<> didn't work for default-argument version, so
call it through a lambda.
@alexreinking alexreinking force-pushed the python/missing-operators branch from 32978ac to 46574ca Compare August 19, 2025 22:04
@alexreinking alexreinking force-pushed the python/missing-operators branch from 46574ca to e7e0a9f Compare August 19, 2025 22:06

m.def("mux", (Expr(*)(const Expr &, const std::vector<Expr> &))&mux);
m.def("mux", static_cast<Expr (*)(const Expr &, const std::vector<Expr> &)>(&mux));
m.def("mux", static_cast<Expr (*)(const Expr &, const Tuple &)>(&mux));
Copy link
Contributor

Choose a reason for hiding this comment

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

Today I learned: overload selection when taking function pointers.

@mcourteaux
Copy link
Contributor

Failures unrelated.

@mcourteaux mcourteaux merged commit 75ddeaf into main Aug 20, 2025
10 of 19 checks passed
@alexreinking alexreinking deleted the python/missing-operators branch August 22, 2025 03:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

python Issues related to Halide/Python interop

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Widening Operation are missing from python bindings IROperator::fast_xxx operations need Python bindings

5 participants