Skip to content

Missing Func::memoize overloads and missing EvictionKey class #8777

@rtzam

Description

@rtzam
>>> from halide import Func
>>> f = Func("f")
>>> f.memoize()
Traceback (most recent call last):
  File "<python-input-2>", line 1, in <module>
    f.memoize()
    ~~~~~~~~~^^
TypeError: memoize(): incompatible function arguments. The following argument types are supported:
    1. (self: halide.halide_.Func, arg0: Halide::EvictionKey) -> halide.halide_.Func

Invoked with: <halide.Func 'f'>

Although the error message gives the second issue away by using the C++ name for EvictionKey instead of a Python name

>>> from halide import EvictionKey
Traceback (most recent call last):
  File "<python-input-3>", line 1, in <module>
    from halide import EvictionKey
ImportError: cannot import name 'EvictionKey' from 'halide' (.venv/lib/python3.13/site-packages/halide/__init__.py)

So memoize() and memoize(EvictionKey) aren't usable from Python. Can both be added please? Thank you!

Metadata

Metadata

Assignees

Labels

pythonIssues related to Halide/Python interop

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions