Add data structure to represent MessagePack "documents" and convert to/from both MessagePack and YAML encodings.
This patch is part of a series required for AMDGPU to support it's new MessagePack metadata.
Paths
| Differential D48175
[BinaryFormat] Add MsgPackTypes ClosedPublic Authored by scott.linder on Jun 14 2018, 9:41 AM.
Details Summary Add data structure to represent MessagePack "documents" and convert to/from both MessagePack and YAML encodings. This patch is part of a series required for AMDGPU to support it's new MessagePack metadata.
Diff Detail
Event Timelinescott.linder added a parent revision: D48144: [Support] Teach YAMLIO about polymorphic types.Jun 14 2018, 9:41 AM scott.linder added a child revision: D48176: [AMDGPU] Refactor HSAMetadataStream::emitKernel (NFC).Jun 14 2018, 9:44 AM
scott.linder added inline comments.
Comment Actions I've updated the patch to just support shared_ptr; I think the more generic option is right for now. Comment Actions
I'd still be curious to understand the usage you're picturing that creates the requirement for shared ownership, if you could paint a bit of a picture around that, that'd be super handy! Comment Actions The use I have in mind is actually an external component which depends on LLVM. We currently implement reading MessagePack metadata there, but when we land the changes to generate it in LLVM it would be nice to avoid duplicating the code there. The rationale for a shared_ptr tree is that our API hands out opaque handles to sub-trees in the metadata which have their own lifetime independent of the root. With shared_ptr this just naturally falls out, but with unique_ptr it requires some book-keeping. I do not see a scenario where the shared_ptr will be needed in LLVM, so if you prefer I am happy to update the patch to use unique_ptr. Comment Actions
Difficult call, but seems OK to me since you'll mostly be the only folks using the data structure anyway. Could you include a representative unit test of this ownership situation? (can be fairly simple, but demonstrate that the root may be built, a subtree taken, then the tree destroyed and the subtree still used). Comment Actions Added test for shared ownership. I've run it locally with ASan and UBSan enabled. And thank you, this will simplify our use-case considerably :) This revision is now accepted and ready to land.Sep 4 2018, 2:54 PM Closed by commit rL346978: [BinaryFormat] Add MsgPackTypes (authored by scott.linder). · Explain WhyNov 15 2018, 10:52 AM This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 174250 llvm/trunk/include/llvm/BinaryFormat/MsgPackTypes.h
llvm/trunk/lib/BinaryFormat/CMakeLists.txt
llvm/trunk/lib/BinaryFormat/MsgPackTypes.cpp
llvm/trunk/unittests/BinaryFormat/CMakeLists.txt
llvm/trunk/unittests/BinaryFormat/MsgPackTypesTest.cpp
|