aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Kunze <eric.kunze@arm.com>2022-10-21 16:40:55 -0700
committerEric Kunze <eric.kunze@arm.com>2023-01-13 11:32:21 -0800
commit250fbcd8bbd0b618f3a2806e4143a670bac0b89b (patch)
tree97ed76da2724b5bf211e67921a0d5bd76836c138
parentab75f53fede64241cb71acbf3b9b0c7d325162d8 (diff)
downloadtosa_mlir_translator-250fbcd8bbd0b618f3a2806e4143a670bac0b89b.tar.gz
Add serialization of custom op attributes
Requires updated serialization_lib submodule Signed-off-by: Eric Kunze <eric.kunze@arm.com> Change-Id: I149680f51242bd45b9a10f7c021f15a59f0ef9c4
-rw-r--r--src/TosaSerialize.cpp14
1 files changed, 13 insertions, 1 deletions
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<mlir::tosa::CustomOp>(
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<mlir::StringAttr>()
+ .getValue()
+ .str();
+
+ std::vector<uint8_t> attrs_data(implementation_attrs.size());
+ memcpy(attrs_data.data(), implementation_attrs.data(), attrs_data.size());
+ TosaCustomAttribute attribute(
+ op.getAttr("identifier").cast<mlir::StringAttr>().getValue().str(),
+ op.getAttr("config").cast<mlir::StringAttr>().getValue().str(),
+ attrs_data);
+
TosaSerializationOperator *tyop = new TosaSerializationOperator(
- Op_CUSTOM, Attribute_NONE, nullptr,
+ Op_CUSTOM, Attribute_CustomAttribute, &attribute,
std::vector<std::string>{input_name},
std::vector<std::string>{output_name});