aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/TestModuleFileExtension.cpp
diff options
context:
space:
mode:
authorPeter Hawkins <phawkins@google.com>2024-12-18 14:16:11 -0500
committerGitHub <noreply@github.com>2024-12-18 11:16:11 -0800
commit41bd35b58bb482fd466aa4b13aa44a810ad6470f (patch)
tree4031a35c28a7191885555d86b086b7b42f81c535 /clang/lib/Frontend/TestModuleFileExtension.cpp
parentbfd05102d817fce38938ce864f89ad90ef0b6cda (diff)
downloadllvm-41bd35b58bb482fd466aa4b13aa44a810ad6470f.zip
llvm-41bd35b58bb482fd466aa4b13aa44a810ad6470f.tar.gz
llvm-41bd35b58bb482fd466aa4b13aa44a810ad6470f.tar.bz2
[mlir python] Port Python core code to nanobind. (#118583)
Why? https://nanobind.readthedocs.io/en/latest/why.html says it better than I can, but my primary motivation for this change is to improve MLIR IR construction time from JAX. For a complicated Google-internal LLM model in JAX, this change improves the MLIR lowering time by around 5s (out of around 30s), which is a significant speedup for simply switching binding frameworks. To a large extent, this is a mechanical change, for instance changing `pybind11::` to `nanobind::`. Notes: * this PR needs Nanobind 2.4.0, because it needs a bug fix (https://github.com/wjakob/nanobind/pull/806) that landed in that release. * this PR does not port the in-tree dialect extension modules. They can be ported in a future PR. * I removed the py::sibling() annotations from def_static and def_class in `PybindAdapters.h`. These ask pybind11 to try to form an overload with an existing method, but it's not possible to form mixed pybind11/nanobind overloads this ways and the parent class is now defined in nanobind. Better solutions may be possible here. * nanobind does not contain an exact equivalent of pybind11's buffer protocol support. It was not hard to add a nanobind implementation of a similar API. * nanobind is pickier about casting to std::vector<bool>, expecting that the input is a sequence of bool types, not truthy values. In a couple of places I added code to support truthy values during casting. * nanobind distinguishes bytes (`nb::bytes`) from strings (e.g., `std::string`). This required nb::bytes overloads in a few places.
Diffstat (limited to 'clang/lib/Frontend/TestModuleFileExtension.cpp')
0 files changed, 0 insertions, 0 deletions