Skip to content

Commit db8bfc8

Browse files
authored
[hipDNN] Add custom op to support for plugin-provided operations (#5341)
## Motivation Adding a new operation to hipDNN today requires changes across the full stack (schema, attributes, node, graph builder, tests). Custom ops provide an escape hatch: users pass an opaque byte payload and tensor I/O topology through the graph, and coordinate directly with the target plugin on the payload's meaning. hipDNN transports the data without needing to understand it. This enables: 1. **Quicker iteration:** plugin authors can add and evolve operations without waiting on hipDNN changes. 2. **Faster support for new ops:** capabilities ship with the plugin, not with a hipDNN release. As a concrete use case, the [Fusilli](https://github.com/iree-org/fusilli) plugin will use custom ops to let users embed MLIR templates in the opaque payload. With this PR landed, the Fusilli hipdnn-plugin can be extended to deserialize the payload, check the `"fusilli."` prefix on `custom_op_id`, and JIT-compile the MLIR, all without any hipDNN-side knowledge of what MLIR is. See the [Fusilli custom op sample](https://github.com/iree-org/fusilli/blob/707358ae866453ed961d443f219c2ef69f2da3c0/samples/custom_op/custom_op_add.cpp) for an example of Fusilli's custom op and [iree-org/fusilli#237](iree-org/fusilli#237) which has example integration tests for the entire flow (hipDNN custom op → Fusilli custom op). ## Technical Details **Frontend:** - `CustomOpAttributes` — attribute class with variable-length positional tensor vectors (unlike other ops which use named tensor maps via `Attributes<>` CRTP base, custom ops use `std::vector` since tensor count is not known at compile time) - `CustomOpNode` — node implementation with `post_validate_node` checking both `custom_op_id` and `compute_data_type`, output tensor validation - `Graph::custom_op()` — builder method creating output tensors and auto-naming **Data SDK:** - New FlatBuffers schema - JSON serialization/deserialization support ## Test Plan - Unit tests for `CustomOpAttributes` (setters/getters, context propagation, FlatBuffer round-trip) - Unit tests for `CustomOpNode` (validation, property inference, serialization) - Graph-level tests for `Graph::custom_op()` - Serialization round-trip tests across all 4 formats (JSON, Binary, FlatBuffer Detached, FlatBuffer Object) - Data SDK JSON switch coverage for `CustomOpAttributes` --------- Signed-off-by: Ian Wood <ianwood@u.northwestern.edu>
1 parent b17df9b commit db8bfc8

File tree

20 files changed

+1803
-11
lines changed

20 files changed

+1803
-11
lines changed

projects/hipdnn/data_sdk/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ if(HIPDNN_GENERATE_SDK_HEADERS)
150150
schemas/convolution_fwd_attributes.fbs
151151
schemas/convolution_bwd_attributes.fbs
152152
schemas/convolution_wrw_attributes.fbs
153+
schemas/custom_op_attributes.fbs
153154
schemas/data_types.fbs
154155
schemas/engine_config.fbs
155156
schemas/engine_details.fbs
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,200 @@
1+
// automatically generated by the FlatBuffers compiler, do not modify
2+
3+
4+
#ifndef FLATBUFFERS_GENERATED_CUSTOMOPATTRIBUTES_HIPDNN_DATA_SDK_DATA_OBJECTS_H_
5+
#define FLATBUFFERS_GENERATED_CUSTOMOPATTRIBUTES_HIPDNN_DATA_SDK_DATA_OBJECTS_H_
6+
7+
#include "flatbuffers/flatbuffers.h"
8+
9+
// Ensure the included flatbuffers.h is the same version as when this file was
10+
// generated, otherwise it may not be compatible.
11+
static_assert(FLATBUFFERS_VERSION_MAJOR == 24 &&
12+
FLATBUFFERS_VERSION_MINOR == 12 &&
13+
FLATBUFFERS_VERSION_REVISION == 23,
14+
"Non-compatible flatbuffers version included");
15+
16+
namespace hipdnn_data_sdk {
17+
namespace data_objects {
18+
19+
struct CustomOpAttributes;
20+
struct CustomOpAttributesBuilder;
21+
struct CustomOpAttributesT;
22+
23+
bool operator==(const CustomOpAttributesT &lhs, const CustomOpAttributesT &rhs);
24+
bool operator!=(const CustomOpAttributesT &lhs, const CustomOpAttributesT &rhs);
25+
26+
struct CustomOpAttributesT : public ::flatbuffers::NativeTable {
27+
typedef CustomOpAttributes TableType;
28+
std::string custom_op_id{};
29+
std::vector<int64_t> input_tensor_uids{};
30+
std::vector<int64_t> output_tensor_uids{};
31+
std::vector<uint8_t> data{};
32+
};
33+
34+
/// Attributes for a custom (plugin-provided) operation.
35+
struct CustomOpAttributes FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
36+
typedef CustomOpAttributesT NativeTableType;
37+
typedef CustomOpAttributesBuilder Builder;
38+
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
39+
VT_CUSTOM_OP_ID = 4,
40+
VT_INPUT_TENSOR_UIDS = 6,
41+
VT_OUTPUT_TENSOR_UIDS = 8,
42+
VT_DATA = 10
43+
};
44+
/// Unique identifier for the plugin operation, using dotted namespace
45+
/// notation: "<plugin>.<operation>" (e.g. "example.rope", "mylib.fused_add").
46+
const ::flatbuffers::String *custom_op_id() const {
47+
return GetPointer<const ::flatbuffers::String *>(VT_CUSTOM_OP_ID);
48+
}
49+
::flatbuffers::String *mutable_custom_op_id() {
50+
return GetPointer<::flatbuffers::String *>(VT_CUSTOM_OP_ID);
51+
}
52+
const ::flatbuffers::Vector<int64_t> *input_tensor_uids() const {
53+
return GetPointer<const ::flatbuffers::Vector<int64_t> *>(VT_INPUT_TENSOR_UIDS);
54+
}
55+
::flatbuffers::Vector<int64_t> *mutable_input_tensor_uids() {
56+
return GetPointer<::flatbuffers::Vector<int64_t> *>(VT_INPUT_TENSOR_UIDS);
57+
}
58+
const ::flatbuffers::Vector<int64_t> *output_tensor_uids() const {
59+
return GetPointer<const ::flatbuffers::Vector<int64_t> *>(VT_OUTPUT_TENSOR_UIDS);
60+
}
61+
::flatbuffers::Vector<int64_t> *mutable_output_tensor_uids() {
62+
return GetPointer<::flatbuffers::Vector<int64_t> *>(VT_OUTPUT_TENSOR_UIDS);
63+
}
64+
const ::flatbuffers::Vector<uint8_t> *data() const {
65+
return GetPointer<const ::flatbuffers::Vector<uint8_t> *>(VT_DATA);
66+
}
67+
::flatbuffers::Vector<uint8_t> *mutable_data() {
68+
return GetPointer<::flatbuffers::Vector<uint8_t> *>(VT_DATA);
69+
}
70+
bool Verify(::flatbuffers::Verifier &verifier) const {
71+
return VerifyTableStart(verifier) &&
72+
VerifyOffset(verifier, VT_CUSTOM_OP_ID) &&
73+
verifier.VerifyString(custom_op_id()) &&
74+
VerifyOffset(verifier, VT_INPUT_TENSOR_UIDS) &&
75+
verifier.VerifyVector(input_tensor_uids()) &&
76+
VerifyOffset(verifier, VT_OUTPUT_TENSOR_UIDS) &&
77+
verifier.VerifyVector(output_tensor_uids()) &&
78+
VerifyOffset(verifier, VT_DATA) &&
79+
verifier.VerifyVector(data()) &&
80+
verifier.EndTable();
81+
}
82+
CustomOpAttributesT *UnPack(const ::flatbuffers::resolver_function_t *_resolver = nullptr) const;
83+
void UnPackTo(CustomOpAttributesT *_o, const ::flatbuffers::resolver_function_t *_resolver = nullptr) const;
84+
static ::flatbuffers::Offset<CustomOpAttributes> Pack(::flatbuffers::FlatBufferBuilder &_fbb, const CustomOpAttributesT* _o, const ::flatbuffers::rehasher_function_t *_rehasher = nullptr);
85+
};
86+
87+
struct CustomOpAttributesBuilder {
88+
typedef CustomOpAttributes Table;
89+
::flatbuffers::FlatBufferBuilder &fbb_;
90+
::flatbuffers::uoffset_t start_;
91+
void add_custom_op_id(::flatbuffers::Offset<::flatbuffers::String> custom_op_id) {
92+
fbb_.AddOffset(CustomOpAttributes::VT_CUSTOM_OP_ID, custom_op_id);
93+
}
94+
void add_input_tensor_uids(::flatbuffers::Offset<::flatbuffers::Vector<int64_t>> input_tensor_uids) {
95+
fbb_.AddOffset(CustomOpAttributes::VT_INPUT_TENSOR_UIDS, input_tensor_uids);
96+
}
97+
void add_output_tensor_uids(::flatbuffers::Offset<::flatbuffers::Vector<int64_t>> output_tensor_uids) {
98+
fbb_.AddOffset(CustomOpAttributes::VT_OUTPUT_TENSOR_UIDS, output_tensor_uids);
99+
}
100+
void add_data(::flatbuffers::Offset<::flatbuffers::Vector<uint8_t>> data) {
101+
fbb_.AddOffset(CustomOpAttributes::VT_DATA, data);
102+
}
103+
explicit CustomOpAttributesBuilder(::flatbuffers::FlatBufferBuilder &_fbb)
104+
: fbb_(_fbb) {
105+
start_ = fbb_.StartTable();
106+
}
107+
::flatbuffers::Offset<CustomOpAttributes> Finish() {
108+
const auto end = fbb_.EndTable(start_);
109+
auto o = ::flatbuffers::Offset<CustomOpAttributes>(end);
110+
return o;
111+
}
112+
};
113+
114+
inline ::flatbuffers::Offset<CustomOpAttributes> CreateCustomOpAttributes(
115+
::flatbuffers::FlatBufferBuilder &_fbb,
116+
::flatbuffers::Offset<::flatbuffers::String> custom_op_id = 0,
117+
::flatbuffers::Offset<::flatbuffers::Vector<int64_t>> input_tensor_uids = 0,
118+
::flatbuffers::Offset<::flatbuffers::Vector<int64_t>> output_tensor_uids = 0,
119+
::flatbuffers::Offset<::flatbuffers::Vector<uint8_t>> data = 0) {
120+
CustomOpAttributesBuilder builder_(_fbb);
121+
builder_.add_data(data);
122+
builder_.add_output_tensor_uids(output_tensor_uids);
123+
builder_.add_input_tensor_uids(input_tensor_uids);
124+
builder_.add_custom_op_id(custom_op_id);
125+
return builder_.Finish();
126+
}
127+
128+
inline ::flatbuffers::Offset<CustomOpAttributes> CreateCustomOpAttributesDirect(
129+
::flatbuffers::FlatBufferBuilder &_fbb,
130+
const char *custom_op_id = nullptr,
131+
const std::vector<int64_t> *input_tensor_uids = nullptr,
132+
const std::vector<int64_t> *output_tensor_uids = nullptr,
133+
const std::vector<uint8_t> *data = nullptr) {
134+
auto custom_op_id__ = custom_op_id ? _fbb.CreateString(custom_op_id) : 0;
135+
auto input_tensor_uids__ = input_tensor_uids ? _fbb.CreateVector<int64_t>(*input_tensor_uids) : 0;
136+
auto output_tensor_uids__ = output_tensor_uids ? _fbb.CreateVector<int64_t>(*output_tensor_uids) : 0;
137+
auto data__ = data ? _fbb.CreateVector<uint8_t>(*data) : 0;
138+
return hipdnn_data_sdk::data_objects::CreateCustomOpAttributes(
139+
_fbb,
140+
custom_op_id__,
141+
input_tensor_uids__,
142+
output_tensor_uids__,
143+
data__);
144+
}
145+
146+
::flatbuffers::Offset<CustomOpAttributes> CreateCustomOpAttributes(::flatbuffers::FlatBufferBuilder &_fbb, const CustomOpAttributesT *_o, const ::flatbuffers::rehasher_function_t *_rehasher = nullptr);
147+
148+
149+
inline bool operator==(const CustomOpAttributesT &lhs, const CustomOpAttributesT &rhs) {
150+
return
151+
(lhs.custom_op_id == rhs.custom_op_id) &&
152+
(lhs.input_tensor_uids == rhs.input_tensor_uids) &&
153+
(lhs.output_tensor_uids == rhs.output_tensor_uids) &&
154+
(lhs.data == rhs.data);
155+
}
156+
157+
inline bool operator!=(const CustomOpAttributesT &lhs, const CustomOpAttributesT &rhs) {
158+
return !(lhs == rhs);
159+
}
160+
161+
162+
inline CustomOpAttributesT *CustomOpAttributes::UnPack(const ::flatbuffers::resolver_function_t *_resolver) const {
163+
auto _o = std::unique_ptr<CustomOpAttributesT>(new CustomOpAttributesT());
164+
UnPackTo(_o.get(), _resolver);
165+
return _o.release();
166+
}
167+
168+
inline void CustomOpAttributes::UnPackTo(CustomOpAttributesT *_o, const ::flatbuffers::resolver_function_t *_resolver) const {
169+
(void)_o;
170+
(void)_resolver;
171+
{ auto _e = custom_op_id(); if (_e) _o->custom_op_id = _e->str(); }
172+
{ auto _e = input_tensor_uids(); if (_e) { _o->input_tensor_uids.resize(_e->size()); for (::flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->input_tensor_uids[_i] = _e->Get(_i); } } else { _o->input_tensor_uids.resize(0); } }
173+
{ auto _e = output_tensor_uids(); if (_e) { _o->output_tensor_uids.resize(_e->size()); for (::flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->output_tensor_uids[_i] = _e->Get(_i); } } else { _o->output_tensor_uids.resize(0); } }
174+
{ auto _e = data(); if (_e) { _o->data.resize(_e->size()); std::copy(_e->begin(), _e->end(), _o->data.begin()); } }
175+
}
176+
177+
inline ::flatbuffers::Offset<CustomOpAttributes> CustomOpAttributes::Pack(::flatbuffers::FlatBufferBuilder &_fbb, const CustomOpAttributesT* _o, const ::flatbuffers::rehasher_function_t *_rehasher) {
178+
return CreateCustomOpAttributes(_fbb, _o, _rehasher);
179+
}
180+
181+
inline ::flatbuffers::Offset<CustomOpAttributes> CreateCustomOpAttributes(::flatbuffers::FlatBufferBuilder &_fbb, const CustomOpAttributesT *_o, const ::flatbuffers::rehasher_function_t *_rehasher) {
182+
(void)_rehasher;
183+
(void)_o;
184+
struct _VectorArgs { ::flatbuffers::FlatBufferBuilder *__fbb; const CustomOpAttributesT* __o; const ::flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va;
185+
auto _custom_op_id = _o->custom_op_id.empty() ? 0 : _fbb.CreateString(_o->custom_op_id);
186+
auto _input_tensor_uids = _o->input_tensor_uids.size() ? _fbb.CreateVector(_o->input_tensor_uids) : 0;
187+
auto _output_tensor_uids = _o->output_tensor_uids.size() ? _fbb.CreateVector(_o->output_tensor_uids) : 0;
188+
auto _data = _o->data.size() ? _fbb.CreateVector(_o->data) : 0;
189+
return hipdnn_data_sdk::data_objects::CreateCustomOpAttributes(
190+
_fbb,
191+
_custom_op_id,
192+
_input_tensor_uids,
193+
_output_tensor_uids,
194+
_data);
195+
}
196+
197+
} // namespace data_objects
198+
} // namespace hipdnn_data_sdk
199+
200+
#endif // FLATBUFFERS_GENERATED_CUSTOMOPATTRIBUTES_HIPDNN_DATA_SDK_DATA_OBJECTS_H_

projects/hipdnn/data_sdk/include/hipdnn_data_sdk/data_objects/v24_12_23/hipdnn_data_sdk/data_objects/graph_generated.h

Lines changed: 57 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ static_assert(FLATBUFFERS_VERSION_MAJOR == 24 &&
2222
#include "convolution_bwd_attributes_generated.h"
2323
#include "convolution_fwd_attributes_generated.h"
2424
#include "convolution_wrw_attributes_generated.h"
25+
#include "custom_op_attributes_generated.h"
2526
#include "data_types_generated.h"
2627
#include "layernorm_attributes_generated.h"
2728
#include "matmul_attributes_generated.h"
@@ -62,11 +63,12 @@ enum class NodeAttributes : uint8_t {
6263
SdpaAttributes = 12,
6364
BlockScaleDequantizeAttributes = 13,
6465
BlockScaleQuantizeAttributes = 14,
66+
CustomOpAttributes = 15,
6567
MIN = NONE,
66-
MAX = BlockScaleQuantizeAttributes
68+
MAX = CustomOpAttributes
6769
};
6870

69-
inline const NodeAttributes (&EnumValuesNodeAttributes())[15] {
71+
inline const NodeAttributes (&EnumValuesNodeAttributes())[16] {
7072
static const NodeAttributes values[] = {
7173
NodeAttributes::NONE,
7274
NodeAttributes::BatchnormInferenceAttributes,
@@ -82,13 +84,14 @@ inline const NodeAttributes (&EnumValuesNodeAttributes())[15] {
8284
NodeAttributes::LayernormAttributes,
8385
NodeAttributes::SdpaAttributes,
8486
NodeAttributes::BlockScaleDequantizeAttributes,
85-
NodeAttributes::BlockScaleQuantizeAttributes
87+
NodeAttributes::BlockScaleQuantizeAttributes,
88+
NodeAttributes::CustomOpAttributes
8689
};
8790
return values;
8891
}
8992

9093
inline const char * const *EnumNamesNodeAttributes() {
91-
static const char * const names[16] = {
94+
static const char * const names[17] = {
9295
"NONE",
9396
"BatchnormInferenceAttributes",
9497
"PointwiseAttributes",
@@ -104,13 +107,14 @@ inline const char * const *EnumNamesNodeAttributes() {
104107
"SdpaAttributes",
105108
"BlockScaleDequantizeAttributes",
106109
"BlockScaleQuantizeAttributes",
110+
"CustomOpAttributes",
107111
nullptr
108112
};
109113
return names;
110114
}
111115

112116
inline const char *EnumNameNodeAttributes(NodeAttributes e) {
113-
if (::flatbuffers::IsOutRange(e, NodeAttributes::NONE, NodeAttributes::BlockScaleQuantizeAttributes)) return "";
117+
if (::flatbuffers::IsOutRange(e, NodeAttributes::NONE, NodeAttributes::CustomOpAttributes)) return "";
114118
const size_t index = static_cast<size_t>(e);
115119
return EnumNamesNodeAttributes()[index];
116120
}
@@ -175,6 +179,10 @@ template<> struct NodeAttributesTraits<hipdnn_data_sdk::data_objects::BlockScale
175179
static const NodeAttributes enum_value = NodeAttributes::BlockScaleQuantizeAttributes;
176180
};
177181

182+
template<> struct NodeAttributesTraits<hipdnn_data_sdk::data_objects::CustomOpAttributes> {
183+
static const NodeAttributes enum_value = NodeAttributes::CustomOpAttributes;
184+
};
185+
178186
template<typename T> struct NodeAttributesUnionTraits {
179187
static const NodeAttributes enum_value = NodeAttributes::NONE;
180188
};
@@ -235,6 +243,10 @@ template<> struct NodeAttributesUnionTraits<hipdnn_data_sdk::data_objects::Block
235243
static const NodeAttributes enum_value = NodeAttributes::BlockScaleQuantizeAttributes;
236244
};
237245

246+
template<> struct NodeAttributesUnionTraits<hipdnn_data_sdk::data_objects::CustomOpAttributesT> {
247+
static const NodeAttributes enum_value = NodeAttributes::CustomOpAttributes;
248+
};
249+
238250
struct NodeAttributesUnion {
239251
NodeAttributes type;
240252
void *value;
@@ -377,6 +389,14 @@ struct NodeAttributesUnion {
377389
return type == NodeAttributes::BlockScaleQuantizeAttributes ?
378390
reinterpret_cast<const hipdnn_data_sdk::data_objects::BlockScaleQuantizeAttributesT *>(value) : nullptr;
379391
}
392+
hipdnn_data_sdk::data_objects::CustomOpAttributesT *AsCustomOpAttributes() {
393+
return type == NodeAttributes::CustomOpAttributes ?
394+
reinterpret_cast<hipdnn_data_sdk::data_objects::CustomOpAttributesT *>(value) : nullptr;
395+
}
396+
const hipdnn_data_sdk::data_objects::CustomOpAttributesT *AsCustomOpAttributes() const {
397+
return type == NodeAttributes::CustomOpAttributes ?
398+
reinterpret_cast<const hipdnn_data_sdk::data_objects::CustomOpAttributesT *>(value) : nullptr;
399+
}
380400
};
381401

382402

@@ -442,6 +462,10 @@ inline bool operator==(const NodeAttributesUnion &lhs, const NodeAttributesUnion
442462
return *(reinterpret_cast<const hipdnn_data_sdk::data_objects::BlockScaleQuantizeAttributesT *>(lhs.value)) ==
443463
*(reinterpret_cast<const hipdnn_data_sdk::data_objects::BlockScaleQuantizeAttributesT *>(rhs.value));
444464
}
465+
case NodeAttributes::CustomOpAttributes: {
466+
return *(reinterpret_cast<const hipdnn_data_sdk::data_objects::CustomOpAttributesT *>(lhs.value)) ==
467+
*(reinterpret_cast<const hipdnn_data_sdk::data_objects::CustomOpAttributesT *>(rhs.value));
468+
}
445469
default: {
446470
return false;
447471
}
@@ -532,6 +556,9 @@ struct Node FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
532556
const hipdnn_data_sdk::data_objects::BlockScaleQuantizeAttributes *attributes_as_BlockScaleQuantizeAttributes() const {
533557
return attributes_type() == hipdnn_data_sdk::data_objects::NodeAttributes::BlockScaleQuantizeAttributes ? static_cast<const hipdnn_data_sdk::data_objects::BlockScaleQuantizeAttributes *>(attributes()) : nullptr;
534558
}
559+
const hipdnn_data_sdk::data_objects::CustomOpAttributes *attributes_as_CustomOpAttributes() const {
560+
return attributes_type() == hipdnn_data_sdk::data_objects::NodeAttributes::CustomOpAttributes ? static_cast<const hipdnn_data_sdk::data_objects::CustomOpAttributes *>(attributes()) : nullptr;
561+
}
535562
void *mutable_attributes() {
536563
return GetPointer<void *>(VT_ATTRIBUTES);
537564
}
@@ -606,6 +633,10 @@ template<> inline const hipdnn_data_sdk::data_objects::BlockScaleQuantizeAttribu
606633
return attributes_as_BlockScaleQuantizeAttributes();
607634
}
608635

636+
template<> inline const hipdnn_data_sdk::data_objects::CustomOpAttributes *Node::attributes_as<hipdnn_data_sdk::data_objects::CustomOpAttributes>() const {
637+
return attributes_as_CustomOpAttributes();
638+
}
639+
609640
struct NodeBuilder {
610641
typedef Node Table;
611642
::flatbuffers::FlatBufferBuilder &fbb_;
@@ -1028,6 +1059,10 @@ inline bool VerifyNodeAttributes(::flatbuffers::Verifier &verifier, const void *
10281059
auto ptr = reinterpret_cast<const hipdnn_data_sdk::data_objects::BlockScaleQuantizeAttributes *>(obj);
10291060
return verifier.VerifyTable(ptr);
10301061
}
1062+
case NodeAttributes::CustomOpAttributes: {
1063+
auto ptr = reinterpret_cast<const hipdnn_data_sdk::data_objects::CustomOpAttributes *>(obj);
1064+
return verifier.VerifyTable(ptr);
1065+
}
10311066
default: return true;
10321067
}
10331068
}
@@ -1103,6 +1138,10 @@ inline void *NodeAttributesUnion::UnPack(const void *obj, NodeAttributes type, c
11031138
auto ptr = reinterpret_cast<const hipdnn_data_sdk::data_objects::BlockScaleQuantizeAttributes *>(obj);
11041139
return ptr->UnPack(resolver);
11051140
}
1141+
case NodeAttributes::CustomOpAttributes: {
1142+
auto ptr = reinterpret_cast<const hipdnn_data_sdk::data_objects::CustomOpAttributes *>(obj);
1143+
return ptr->UnPack(resolver);
1144+
}
11061145
default: return nullptr;
11071146
}
11081147
}
@@ -1166,6 +1205,10 @@ inline ::flatbuffers::Offset<void> NodeAttributesUnion::Pack(::flatbuffers::Flat
11661205
auto ptr = reinterpret_cast<const hipdnn_data_sdk::data_objects::BlockScaleQuantizeAttributesT *>(value);
11671206
return CreateBlockScaleQuantizeAttributes(_fbb, ptr, _rehasher).Union();
11681207
}
1208+
case NodeAttributes::CustomOpAttributes: {
1209+
auto ptr = reinterpret_cast<const hipdnn_data_sdk::data_objects::CustomOpAttributesT *>(value);
1210+
return CreateCustomOpAttributes(_fbb, ptr, _rehasher).Union();
1211+
}
11691212
default: return 0;
11701213
}
11711214
}
@@ -1228,6 +1271,10 @@ inline NodeAttributesUnion::NodeAttributesUnion(const NodeAttributesUnion &u) :
12281271
value = new hipdnn_data_sdk::data_objects::BlockScaleQuantizeAttributesT(*reinterpret_cast<hipdnn_data_sdk::data_objects::BlockScaleQuantizeAttributesT *>(u.value));
12291272
break;
12301273
}
1274+
case NodeAttributes::CustomOpAttributes: {
1275+
value = new hipdnn_data_sdk::data_objects::CustomOpAttributesT(*reinterpret_cast<hipdnn_data_sdk::data_objects::CustomOpAttributesT *>(u.value));
1276+
break;
1277+
}
12311278
default:
12321279
break;
12331280
}
@@ -1305,6 +1352,11 @@ inline void NodeAttributesUnion::Reset() {
13051352
delete ptr;
13061353
break;
13071354
}
1355+
case NodeAttributes::CustomOpAttributes: {
1356+
auto ptr = reinterpret_cast<hipdnn_data_sdk::data_objects::CustomOpAttributesT *>(value);
1357+
delete ptr;
1358+
break;
1359+
}
13081360
default: break;
13091361
}
13101362
value = nullptr;

0 commit comments

Comments
 (0)