[Mlir-commits] [mlir] [mlir:python] Prevent crash in DenseElementsAttr. (PR #163564)

Maksim Levental llvmlistbot at llvm.org
Mon Oct 20 08:02:10 PDT 2025


makslevental wrote:

> I have just stumbled upon [DLPack](https://github.com/dmlc/dlpack). That's probably a good way to replace the `bf_getbuffer` protocol with support for more data types. It's what nanobind uses for `nb::ndarray`.

nanobind's dlpack isn't "real" - they don't actually use the dlpack header and have a [reimplementation](https://github.com/wjakob/nanobind/blob/ab3456fc06c483e3a824c91da7b5955882cac442/include/nanobind/ndarray.h#L24). So it'll solve your bf16 problem but won't work for the other dtypes that dlpack should support (I know this because I had your same exact problem last 2 weeks ago but for f8).

https://github.com/llvm/llvm-project/pull/163564


More information about the Mlir-commits mailing list