This is an archive of the discontinued LLVM Phabricator instance.

[mlir] Extend C and Python API to support bulk loading of DenseElementsAttr.
ClosedPublic

Authored by stellaraccident on Oct 6 2021, 6:44 PM.

Details

Summary
  • This already half existed in terms of reading the raw buffer backing a DenseElementsAttr.
  • Documented the precise expectations of the buffer layout.
  • Extended the Python API to support construction from bitcasted buffers, allowing construction of all primitive element types (even those that lack a compatible representation in Python).
  • Specifically, the Python API can now load all integer types at all bit widths and all floating point types (f16, f32, f64, bf16).

Diff Detail

Event Timeline

stellaraccident created this revision.Oct 6 2021, 6:44 PM
stellaraccident requested review of this revision.Oct 6 2021, 6:44 PM
rriddle added inline comments.Oct 6 2021, 6:49 PM
mlir/lib/IR/BuiltinAttributes.cpp
795–805

This no longer updates detectedSplat.

Fix detectedSplat.

mlir/lib/IR/BuiltinAttributes.cpp
795–805

Whoops - was fiddling with this post running the tests and messed it up. Updated.

mehdi_amini accepted this revision.Oct 6 2021, 10:30 PM

Thanks for all the nice doc!

This revision is now accepted and ready to land.Oct 6 2021, 10:30 PM