aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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});