https://github.com/halide/Halide
Revision 73c61c3a228228900cbfe5c8ebdd8bbe0dd9ef04 authored by Steven Johnson on 28 November 2022, 21:52:51 UTC, committed by GitHub on 28 November 2022, 21:52:51 UTC
Add optional "function_info" header output

At first glance, this looks like a subset of what is already provided by the `_metadata()` functionality: describing the argument attributes of an AOT-generated Halide function. However, _metadata() is suboptimal for some use cases: Because it's expressed as ordinary data, we can only process it at runtime; the new fuctionality is expressed as a `constexpr` data structure, meaning we can process it at *compile* time if we so choose. (This is quite useful for producing automatic call wrappers, etc).

At first I considered adding this to the normal `.h` file, but moving it into a new file is cleaner in a few ways:
- It maintains the 'C-only' nature of the existing .h files (adding this would have imposed a C++17-only section on them)
- Splitting into a new file means no existing users are affected by this change at all

Note also that this is deliberately not replicating all of the existing `_metadata()` functionality (it's just the argument signature, but no e.g. estimates or default values, etc). This approach means that it is probably more sensible to add several separate constexpr "getters" to this file, rather than trying to mash everything together into one clumsy structure. (With _metadata(), there was an incentive to keep the surface area of the API small, even if that meant combining somewhat-unrelated concerns; there is no such incentive here.)
1 parent 3ff9e66
History
Tip revision: 73c61c3a228228900cbfe5c8ebdd8bbe0dd9ef04 authored by Steven Johnson on 28 November 2022, 21:52:51 UTC
Add optional "function_info" header output (#7170)
Tip revision: 73c61c3
File Mode Size
.github
apps
cmake
dependencies
doc
packaging
python_bindings
src
test
tools
tutorial
util
.clang-format -rw-r--r-- 1.4 KB
.clang-format-ignore -rw-r--r-- 286 bytes
.clang-tidy -rw-r--r-- 2.2 KB
.gitattributes -rw-r--r-- 342 bytes
.gitignore -rw-r--r-- 5.0 KB
.gitmodules -rw-r--r-- 0 bytes
CMakeLists.txt -rw-r--r-- 5.5 KB
CMakePresets.json -rw-r--r-- 5.6 KB
CODE_OF_CONDUCT.md -rw-r--r-- 3.5 KB
LICENSE.txt -rw-r--r-- 13.8 KB
MANIFEST.in -rw-r--r-- 159 bytes
Makefile -rw-r--r-- 103.1 KB
README.md -rw-r--r-- 16.4 KB
README_cmake.md -rw-r--r-- 75.4 KB
README_python.md -rw-r--r-- 32.1 KB
README_rungen.md -rw-r--r-- 12.1 KB
README_webassembly.md -rw-r--r-- 10.5 KB
pyproject.toml -rw-r--r-- 195 bytes
requirements.txt -rw-r--r-- 129 bytes
run-clang-format.sh -rwxr-xr-x 1.4 KB
run-clang-tidy.sh -rwxr-xr-x 3.1 KB
setup.py -rw-r--r-- 1.2 KB

README.md

back to top