From 250fbcd8bbd0b618f3a2806e4143a670bac0b89b Mon Sep 17 00:00:00 2001 From: Eric Kunze Date: Fri, 21 Oct 2022 16:40:55 -0700 Subject: Add serialization of custom op attributes Requires updated serialization_lib submodule Signed-off-by: Eric Kunze Change-Id: I149680f51242bd45b9a10f7c021f15a59f0ef9c4 --- src/TosaSerialize.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/TosaSerialize.cpp b/src/TosaSerialize.cpp index 67fd1c5..ea0c32f 100644 --- a/src/TosaSerialize.cpp +++ b/src/TosaSerialize.cpp @@ -1260,8 +1260,20 @@ TosaSerializationOperatorBuilder::build( std::string input_name = GetTensorName(op.getOperand(0)); std::string output_name = GetTensorName(op.getResult(0)); + const std::string implementation_attrs = op.getAttr("implementation_attrs") + .cast() + .getValue() + .str(); + + std::vector attrs_data(implementation_attrs.size()); + memcpy(attrs_data.data(), implementation_attrs.data(), attrs_data.size()); + TosaCustomAttribute attribute( + op.getAttr("identifier").cast().getValue().str(), + op.getAttr("config").cast().getValue().str(), + attrs_data); + TosaSerializationOperator *tyop = new TosaSerializationOperator( - Op_CUSTOM, Attribute_NONE, nullptr, + Op_CUSTOM, Attribute_CustomAttribute, &attribute, std::vector{input_name}, std::vector{output_name}); -- cgit v1.2.1