Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ static_assert(FLATBUFFERS_VERSION_MAJOR == 24 &&
#include "layernorm_attributes_generated.h"
#include "matmul_attributes_generated.h"
#include "pointwise_attributes_generated.h"
#include "reduction_attributes_generated.h"
#include "rmsnorm_attributes_generated.h"
#include "sdpa_attributes_generated.h"
#include "sdpa_backward_attributes_generated.h"
Expand Down Expand Up @@ -66,11 +67,12 @@ enum class NodeAttributes : uint8_t {
BlockScaleQuantizeAttributes = 14,
SdpaBackwardAttributes = 15,
CustomOpAttributes = 16,
ReductionAttributes = 17,
MIN = NONE,
MAX = CustomOpAttributes
MAX = ReductionAttributes
};

inline const NodeAttributes (&EnumValuesNodeAttributes())[17] {
inline const NodeAttributes (&EnumValuesNodeAttributes())[18] {
static const NodeAttributes values[] = {
NodeAttributes::NONE,
NodeAttributes::BatchnormInferenceAttributes,
Expand All @@ -88,13 +90,14 @@ inline const NodeAttributes (&EnumValuesNodeAttributes())[17] {
NodeAttributes::BlockScaleDequantizeAttributes,
NodeAttributes::BlockScaleQuantizeAttributes,
NodeAttributes::SdpaBackwardAttributes,
NodeAttributes::CustomOpAttributes
NodeAttributes::CustomOpAttributes,
NodeAttributes::ReductionAttributes
};
return values;
}

inline const char * const *EnumNamesNodeAttributes() {
static const char * const names[18] = {
static const char * const names[19] = {
"NONE",
"BatchnormInferenceAttributes",
"PointwiseAttributes",
Expand All @@ -112,13 +115,14 @@ inline const char * const *EnumNamesNodeAttributes() {
"BlockScaleQuantizeAttributes",
"SdpaBackwardAttributes",
"CustomOpAttributes",
"ReductionAttributes",
nullptr
};
return names;
}

inline const char *EnumNameNodeAttributes(NodeAttributes e) {
if (::flatbuffers::IsOutRange(e, NodeAttributes::NONE, NodeAttributes::CustomOpAttributes)) return "";
if (::flatbuffers::IsOutRange(e, NodeAttributes::NONE, NodeAttributes::ReductionAttributes)) return "";
const size_t index = static_cast<size_t>(e);
return EnumNamesNodeAttributes()[index];
}
Expand Down Expand Up @@ -191,6 +195,10 @@ template<> struct NodeAttributesTraits<hipdnn_data_sdk::data_objects::CustomOpAt
static const NodeAttributes enum_value = NodeAttributes::CustomOpAttributes;
};

template<> struct NodeAttributesTraits<hipdnn_data_sdk::data_objects::ReductionAttributes> {
static const NodeAttributes enum_value = NodeAttributes::ReductionAttributes;
};

template<typename T> struct NodeAttributesUnionTraits {
static const NodeAttributes enum_value = NodeAttributes::NONE;
};
Expand Down Expand Up @@ -259,6 +267,10 @@ template<> struct NodeAttributesUnionTraits<hipdnn_data_sdk::data_objects::Custo
static const NodeAttributes enum_value = NodeAttributes::CustomOpAttributes;
};

template<> struct NodeAttributesUnionTraits<hipdnn_data_sdk::data_objects::ReductionAttributesT> {
static const NodeAttributes enum_value = NodeAttributes::ReductionAttributes;
};

struct NodeAttributesUnion {
NodeAttributes type;
void *value;
Expand Down Expand Up @@ -417,6 +429,14 @@ struct NodeAttributesUnion {
return type == NodeAttributes::CustomOpAttributes ?
reinterpret_cast<const hipdnn_data_sdk::data_objects::CustomOpAttributesT *>(value) : nullptr;
}
hipdnn_data_sdk::data_objects::ReductionAttributesT *AsReductionAttributes() {
return type == NodeAttributes::ReductionAttributes ?
reinterpret_cast<hipdnn_data_sdk::data_objects::ReductionAttributesT *>(value) : nullptr;
}
const hipdnn_data_sdk::data_objects::ReductionAttributesT *AsReductionAttributes() const {
return type == NodeAttributes::ReductionAttributes ?
reinterpret_cast<const hipdnn_data_sdk::data_objects::ReductionAttributesT *>(value) : nullptr;
}
};


Expand Down Expand Up @@ -490,6 +510,10 @@ inline bool operator==(const NodeAttributesUnion &lhs, const NodeAttributesUnion
return *(reinterpret_cast<const hipdnn_data_sdk::data_objects::CustomOpAttributesT *>(lhs.value)) ==
*(reinterpret_cast<const hipdnn_data_sdk::data_objects::CustomOpAttributesT *>(rhs.value));
}
case NodeAttributes::ReductionAttributes: {
return *(reinterpret_cast<const hipdnn_data_sdk::data_objects::ReductionAttributesT *>(lhs.value)) ==
*(reinterpret_cast<const hipdnn_data_sdk::data_objects::ReductionAttributesT *>(rhs.value));
}
default: {
return false;
}
Expand Down Expand Up @@ -586,6 +610,9 @@ struct Node FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
const hipdnn_data_sdk::data_objects::CustomOpAttributes *attributes_as_CustomOpAttributes() const {
return attributes_type() == hipdnn_data_sdk::data_objects::NodeAttributes::CustomOpAttributes ? static_cast<const hipdnn_data_sdk::data_objects::CustomOpAttributes *>(attributes()) : nullptr;
}
const hipdnn_data_sdk::data_objects::ReductionAttributes *attributes_as_ReductionAttributes() const {
return attributes_type() == hipdnn_data_sdk::data_objects::NodeAttributes::ReductionAttributes ? static_cast<const hipdnn_data_sdk::data_objects::ReductionAttributes *>(attributes()) : nullptr;
}
void *mutable_attributes() {
return GetPointer<void *>(VT_ATTRIBUTES);
}
Expand Down Expand Up @@ -668,6 +695,10 @@ template<> inline const hipdnn_data_sdk::data_objects::CustomOpAttributes *Node:
return attributes_as_CustomOpAttributes();
}

template<> inline const hipdnn_data_sdk::data_objects::ReductionAttributes *Node::attributes_as<hipdnn_data_sdk::data_objects::ReductionAttributes>() const {
return attributes_as_ReductionAttributes();
}

struct NodeBuilder {
typedef Node Table;
::flatbuffers::FlatBufferBuilder &fbb_;
Expand Down Expand Up @@ -1098,6 +1129,10 @@ inline bool VerifyNodeAttributes(::flatbuffers::Verifier &verifier, const void *
auto ptr = reinterpret_cast<const hipdnn_data_sdk::data_objects::CustomOpAttributes *>(obj);
return verifier.VerifyTable(ptr);
}
case NodeAttributes::ReductionAttributes: {
auto ptr = reinterpret_cast<const hipdnn_data_sdk::data_objects::ReductionAttributes *>(obj);
return verifier.VerifyTable(ptr);
}
default: return true;
}
}
Expand Down Expand Up @@ -1181,6 +1216,10 @@ inline void *NodeAttributesUnion::UnPack(const void *obj, NodeAttributes type, c
auto ptr = reinterpret_cast<const hipdnn_data_sdk::data_objects::CustomOpAttributes *>(obj);
return ptr->UnPack(resolver);
}
case NodeAttributes::ReductionAttributes: {
auto ptr = reinterpret_cast<const hipdnn_data_sdk::data_objects::ReductionAttributes *>(obj);
return ptr->UnPack(resolver);
}
default: return nullptr;
}
}
Expand Down Expand Up @@ -1252,6 +1291,10 @@ inline ::flatbuffers::Offset<void> NodeAttributesUnion::Pack(::flatbuffers::Flat
auto ptr = reinterpret_cast<const hipdnn_data_sdk::data_objects::CustomOpAttributesT *>(value);
return CreateCustomOpAttributes(_fbb, ptr, _rehasher).Union();
}
case NodeAttributes::ReductionAttributes: {
auto ptr = reinterpret_cast<const hipdnn_data_sdk::data_objects::ReductionAttributesT *>(value);
return CreateReductionAttributes(_fbb, ptr, _rehasher).Union();
}
default: return 0;
}
}
Expand Down Expand Up @@ -1322,6 +1365,10 @@ inline NodeAttributesUnion::NodeAttributesUnion(const NodeAttributesUnion &u) :
value = new hipdnn_data_sdk::data_objects::CustomOpAttributesT(*reinterpret_cast<hipdnn_data_sdk::data_objects::CustomOpAttributesT *>(u.value));
break;
}
case NodeAttributes::ReductionAttributes: {
value = new hipdnn_data_sdk::data_objects::ReductionAttributesT(*reinterpret_cast<hipdnn_data_sdk::data_objects::ReductionAttributesT *>(u.value));
break;
}
default:
break;
}
Expand Down Expand Up @@ -1409,6 +1456,11 @@ inline void NodeAttributesUnion::Reset() {
delete ptr;
break;
}
case NodeAttributes::ReductionAttributes: {
auto ptr = reinterpret_cast<hipdnn_data_sdk::data_objects::ReductionAttributesT *>(value);
delete ptr;
break;
}
default: break;
}
value = nullptr;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,213 @@
// automatically generated by the FlatBuffers compiler, do not modify


#ifndef FLATBUFFERS_GENERATED_REDUCTIONATTRIBUTES_HIPDNN_DATA_SDK_DATA_OBJECTS_H_
#define FLATBUFFERS_GENERATED_REDUCTIONATTRIBUTES_HIPDNN_DATA_SDK_DATA_OBJECTS_H_

#include "flatbuffers/flatbuffers.h"

// Ensure the included flatbuffers.h is the same version as when this file was
// generated, otherwise it may not be compatible.
static_assert(FLATBUFFERS_VERSION_MAJOR == 24 &&
FLATBUFFERS_VERSION_MINOR == 12 &&
FLATBUFFERS_VERSION_REVISION == 23,
"Non-compatible flatbuffers version included");

#include "data_types_generated.h"

namespace hipdnn_data_sdk {
namespace data_objects {

struct ReductionAttributes;
struct ReductionAttributesBuilder;
struct ReductionAttributesT;

bool operator==(const ReductionAttributesT &lhs, const ReductionAttributesT &rhs);
bool operator!=(const ReductionAttributesT &lhs, const ReductionAttributesT &rhs);

enum class ReductionMode : int8_t {
NOT_SET = 0,
ADD = 1,
MUL = 2,
MIN_OP = 3,
MAX_OP = 4,
AMAX = 5,
AVG = 6,
NORM1 = 7,
NORM2 = 8,
MUL_NO_ZEROS = 9,
MIN = NOT_SET,
MAX = MUL_NO_ZEROS
};

inline const ReductionMode (&EnumValuesReductionMode())[10] {
static const ReductionMode values[] = {
ReductionMode::NOT_SET,
ReductionMode::ADD,
ReductionMode::MUL,
ReductionMode::MIN_OP,
ReductionMode::MAX_OP,
ReductionMode::AMAX,
ReductionMode::AVG,
ReductionMode::NORM1,
ReductionMode::NORM2,
ReductionMode::MUL_NO_ZEROS
};
return values;
}

inline const char * const *EnumNamesReductionMode() {
static const char * const names[11] = {
"NOT_SET",
"ADD",
"MUL",
"MIN_OP",
"MAX_OP",
"AMAX",
"AVG",
"NORM1",
"NORM2",
"MUL_NO_ZEROS",
nullptr
};
return names;
}

inline const char *EnumNameReductionMode(ReductionMode e) {
if (::flatbuffers::IsOutRange(e, ReductionMode::NOT_SET, ReductionMode::MUL_NO_ZEROS)) return "";
const size_t index = static_cast<size_t>(e);
return EnumNamesReductionMode()[index];
}

struct ReductionAttributesT : public ::flatbuffers::NativeTable {
typedef ReductionAttributes TableType;
hipdnn_data_sdk::data_objects::ReductionMode mode = hipdnn_data_sdk::data_objects::ReductionMode::NOT_SET;
int64_t in_tensor_uid = 0;
int64_t out_tensor_uid = 0;
};

struct ReductionAttributes FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
typedef ReductionAttributesT NativeTableType;
typedef ReductionAttributesBuilder Builder;
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
VT_MODE = 4,
VT_IN_TENSOR_UID = 6,
VT_OUT_TENSOR_UID = 8
};
hipdnn_data_sdk::data_objects::ReductionMode mode() const {
return static_cast<hipdnn_data_sdk::data_objects::ReductionMode>(GetField<int8_t>(VT_MODE, 0));
}
bool mutate_mode(hipdnn_data_sdk::data_objects::ReductionMode _mode = static_cast<hipdnn_data_sdk::data_objects::ReductionMode>(0)) {
return SetField<int8_t>(VT_MODE, static_cast<int8_t>(_mode), 0);
}
int64_t in_tensor_uid() const {
return GetField<int64_t>(VT_IN_TENSOR_UID, 0);
}
bool mutate_in_tensor_uid(int64_t _in_tensor_uid = 0) {
return SetField<int64_t>(VT_IN_TENSOR_UID, _in_tensor_uid, 0);
}
int64_t out_tensor_uid() const {
return GetField<int64_t>(VT_OUT_TENSOR_UID, 0);
}
bool mutate_out_tensor_uid(int64_t _out_tensor_uid = 0) {
return SetField<int64_t>(VT_OUT_TENSOR_UID, _out_tensor_uid, 0);
}
bool Verify(::flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
VerifyField<int8_t>(verifier, VT_MODE, 1) &&
VerifyField<int64_t>(verifier, VT_IN_TENSOR_UID, 8) &&
VerifyField<int64_t>(verifier, VT_OUT_TENSOR_UID, 8) &&
verifier.EndTable();
}
ReductionAttributesT *UnPack(const ::flatbuffers::resolver_function_t *_resolver = nullptr) const;
void UnPackTo(ReductionAttributesT *_o, const ::flatbuffers::resolver_function_t *_resolver = nullptr) const;
static ::flatbuffers::Offset<ReductionAttributes> Pack(::flatbuffers::FlatBufferBuilder &_fbb, const ReductionAttributesT* _o, const ::flatbuffers::rehasher_function_t *_rehasher = nullptr);
};

struct ReductionAttributesBuilder {
typedef ReductionAttributes Table;
::flatbuffers::FlatBufferBuilder &fbb_;
::flatbuffers::uoffset_t start_;
void add_mode(hipdnn_data_sdk::data_objects::ReductionMode mode) {
fbb_.AddElement<int8_t>(ReductionAttributes::VT_MODE, static_cast<int8_t>(mode), 0);
}
void add_in_tensor_uid(int64_t in_tensor_uid) {
fbb_.AddElement<int64_t>(ReductionAttributes::VT_IN_TENSOR_UID, in_tensor_uid, 0);
}
void add_out_tensor_uid(int64_t out_tensor_uid) {
fbb_.AddElement<int64_t>(ReductionAttributes::VT_OUT_TENSOR_UID, out_tensor_uid, 0);
}
explicit ReductionAttributesBuilder(::flatbuffers::FlatBufferBuilder &_fbb)
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
::flatbuffers::Offset<ReductionAttributes> Finish() {
const auto end = fbb_.EndTable(start_);
auto o = ::flatbuffers::Offset<ReductionAttributes>(end);
return o;
}
};

inline ::flatbuffers::Offset<ReductionAttributes> CreateReductionAttributes(
::flatbuffers::FlatBufferBuilder &_fbb,
hipdnn_data_sdk::data_objects::ReductionMode mode = hipdnn_data_sdk::data_objects::ReductionMode::NOT_SET,
int64_t in_tensor_uid = 0,
int64_t out_tensor_uid = 0) {
ReductionAttributesBuilder builder_(_fbb);
builder_.add_out_tensor_uid(out_tensor_uid);
builder_.add_in_tensor_uid(in_tensor_uid);
builder_.add_mode(mode);
return builder_.Finish();
}

::flatbuffers::Offset<ReductionAttributes> CreateReductionAttributes(::flatbuffers::FlatBufferBuilder &_fbb, const ReductionAttributesT *_o, const ::flatbuffers::rehasher_function_t *_rehasher = nullptr);


inline bool operator==(const ReductionAttributesT &lhs, const ReductionAttributesT &rhs) {
return
(lhs.mode == rhs.mode) &&
(lhs.in_tensor_uid == rhs.in_tensor_uid) &&
(lhs.out_tensor_uid == rhs.out_tensor_uid);
}

inline bool operator!=(const ReductionAttributesT &lhs, const ReductionAttributesT &rhs) {
return !(lhs == rhs);
}


inline ReductionAttributesT *ReductionAttributes::UnPack(const ::flatbuffers::resolver_function_t *_resolver) const {
auto _o = std::unique_ptr<ReductionAttributesT>(new ReductionAttributesT());
UnPackTo(_o.get(), _resolver);
return _o.release();
}

inline void ReductionAttributes::UnPackTo(ReductionAttributesT *_o, const ::flatbuffers::resolver_function_t *_resolver) const {
(void)_o;
(void)_resolver;
{ auto _e = mode(); _o->mode = _e; }
{ auto _e = in_tensor_uid(); _o->in_tensor_uid = _e; }
{ auto _e = out_tensor_uid(); _o->out_tensor_uid = _e; }
}

inline ::flatbuffers::Offset<ReductionAttributes> ReductionAttributes::Pack(::flatbuffers::FlatBufferBuilder &_fbb, const ReductionAttributesT* _o, const ::flatbuffers::rehasher_function_t *_rehasher) {
return CreateReductionAttributes(_fbb, _o, _rehasher);
}

inline ::flatbuffers::Offset<ReductionAttributes> CreateReductionAttributes(::flatbuffers::FlatBufferBuilder &_fbb, const ReductionAttributesT *_o, const ::flatbuffers::rehasher_function_t *_rehasher) {
(void)_rehasher;
(void)_o;
struct _VectorArgs { ::flatbuffers::FlatBufferBuilder *__fbb; const ReductionAttributesT* __o; const ::flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va;
auto _mode = _o->mode;
auto _in_tensor_uid = _o->in_tensor_uid;
auto _out_tensor_uid = _o->out_tensor_uid;
return hipdnn_data_sdk::data_objects::CreateReductionAttributes(
_fbb,
_mode,
_in_tensor_uid,
_out_tensor_uid);
}

} // namespace data_objects
} // namespace hipdnn_data_sdk

#endif // FLATBUFFERS_GENERATED_REDUCTIONATTRIBUTES_HIPDNN_DATA_SDK_DATA_OBJECTS_H_
Loading
Loading