[mlir] Get array from the dense elements attribute with buffer protocol.
authorzhanghb97 <hongbin2019@iscas.ac.cn>
Sun, 8 Nov 2020 01:28:35 +0000 (09:28 +0800)
committerzhanghb97 <hongbin2019@iscas.ac.cn>
Wed, 18 Nov 2020 07:50:59 +0000 (15:50 +0800)
commit77133b29b93406638915c7d9a6b8b8a81a067df3
treeac04009b4846e7293c502a2da881237abb9a2ea2
parentf0b0bab34dd82c07d153d31363d89ebd04cc733d
[mlir] Get array from the dense elements attribute with buffer protocol.

- Add `mlirElementsAttrGetType` C API.
- Add `def_buffer` binding to PyDenseElementsAttribute.
- Implement the protocol to access the buffer.

Differential Revision: https://reviews.llvm.org/D91021
mlir/docs/Bindings/Python.md
mlir/include/mlir-c/StandardAttributes.h
mlir/lib/Bindings/Python/IRModules.cpp
mlir/lib/CAPI/IR/StandardAttributes.cpp
mlir/test/Bindings/Python/ir_array_attributes.py
mlir/test/CAPI/ir.c