Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add unique_op #9819

Merged
merged 10 commits into from
Dec 23, 2022
Merged
Show file tree
Hide file tree
Changes from 7 commits
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
383 changes: 383 additions & 0 deletions lite/backends/opencl/utils/tune_cache_generated.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,383 @@
// automatically generated by the FlatBuffers compiler, do not modify


#ifndef FLATBUFFERS_GENERATED_TUNECACHE_PADDLE_LITE_FBS_OPENCL_PROTO_H_
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个文件也不要提交

#define FLATBUFFERS_GENERATED_TUNECACHE_PADDLE_LITE_FBS_OPENCL_PROTO_H_

#include "flatbuffers/flatbuffers.h"

namespace paddle {
namespace lite {
namespace fbs {
namespace opencl {
namespace proto {
namespace TuneCache_ {

struct TunePair;
struct TunePairBuilder;
struct TunePairT;

} // namespace TuneCache_

struct TuneCache;
struct TuneCacheBuilder;
struct TuneCacheT;

namespace TuneCache_ {

bool operator==(const TunePairT &lhs, const TunePairT &rhs);
bool operator!=(const TunePairT &lhs, const TunePairT &rhs);
} // namespace TuneCache_

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

namespace TuneCache_ {

inline const flatbuffers::TypeTable *TunePairTypeTable();

} // namespace TuneCache_

inline const flatbuffers::TypeTable *TuneCacheTypeTable();

namespace TuneCache_ {

struct TunePairT : public flatbuffers::NativeTable {
typedef TunePair TableType;
std::string key;
std::vector<int32_t> value;
TunePairT() {
}
};

inline bool operator==(const TunePairT &lhs, const TunePairT &rhs) {
return
(lhs.key == rhs.key) &&
(lhs.value == rhs.value);
}

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


struct TunePair FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
typedef TunePairT NativeTableType;
typedef TunePairBuilder Builder;
static const flatbuffers::TypeTable *MiniReflectTypeTable() {
return TunePairTypeTable();
}
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
VT_KEY = 4,
VT_VALUE = 6
};
const flatbuffers::String *key() const {
return GetPointer<const flatbuffers::String *>(VT_KEY);
}
flatbuffers::String *mutable_key() {
return GetPointer<flatbuffers::String *>(VT_KEY);
}
bool KeyCompareLessThan(const TunePair *o) const {
return *key() < *o->key();
}
int KeyCompareWithValue(const char *val) const {
return strcmp(key()->c_str(), val);
}
const flatbuffers::Vector<int32_t> *value() const {
return GetPointer<const flatbuffers::Vector<int32_t> *>(VT_VALUE);
}
flatbuffers::Vector<int32_t> *mutable_value() {
return GetPointer<flatbuffers::Vector<int32_t> *>(VT_VALUE);
}
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
VerifyOffsetRequired(verifier, VT_KEY) &&
verifier.VerifyString(key()) &&
VerifyOffset(verifier, VT_VALUE) &&
verifier.VerifyVector(value()) &&
verifier.EndTable();
}
TunePairT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const;
void UnPackTo(TunePairT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const;
static flatbuffers::Offset<TunePair> Pack(flatbuffers::FlatBufferBuilder &_fbb, const TunePairT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
};

struct TunePairBuilder {
typedef TunePair Table;
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
void add_key(flatbuffers::Offset<flatbuffers::String> key) {
fbb_.AddOffset(TunePair::VT_KEY, key);
}
void add_value(flatbuffers::Offset<flatbuffers::Vector<int32_t>> value) {
fbb_.AddOffset(TunePair::VT_VALUE, value);
}
explicit TunePairBuilder(flatbuffers::FlatBufferBuilder &_fbb)
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
TunePairBuilder &operator=(const TunePairBuilder &);
flatbuffers::Offset<TunePair> Finish() {
const auto end = fbb_.EndTable(start_);
auto o = flatbuffers::Offset<TunePair>(end);
fbb_.Required(o, TunePair::VT_KEY);
return o;
}
};

inline flatbuffers::Offset<TunePair> CreateTunePair(
flatbuffers::FlatBufferBuilder &_fbb,
flatbuffers::Offset<flatbuffers::String> key = 0,
flatbuffers::Offset<flatbuffers::Vector<int32_t>> value = 0) {
TunePairBuilder builder_(_fbb);
builder_.add_value(value);
builder_.add_key(key);
return builder_.Finish();
}

inline flatbuffers::Offset<TunePair> CreateTunePairDirect(
flatbuffers::FlatBufferBuilder &_fbb,
const char *key = nullptr,
const std::vector<int32_t> *value = nullptr) {
auto key__ = key ? _fbb.CreateString(key) : 0;
auto value__ = value ? _fbb.CreateVector<int32_t>(*value) : 0;
return paddle::lite::fbs::opencl::proto::TuneCache_::CreateTunePair(
_fbb,
key__,
value__);
}

flatbuffers::Offset<TunePair> CreateTunePair(flatbuffers::FlatBufferBuilder &_fbb, const TunePairT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);

} // namespace TuneCache_

struct TuneCacheT : public flatbuffers::NativeTable {
typedef TuneCache TableType;
std::vector<std::unique_ptr<paddle::lite::fbs::opencl::proto::TuneCache_::TunePairT>> tune_map;
TuneCacheT() {
}
};

inline bool operator==(const TuneCacheT &lhs, const TuneCacheT &rhs) {
return
(lhs.tune_map == rhs.tune_map);
}

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


struct TuneCache FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
typedef TuneCacheT NativeTableType;
typedef TuneCacheBuilder Builder;
static const flatbuffers::TypeTable *MiniReflectTypeTable() {
return TuneCacheTypeTable();
}
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
VT_TUNE_MAP = 4
};
const flatbuffers::Vector<flatbuffers::Offset<paddle::lite::fbs::opencl::proto::TuneCache_::TunePair>> *tune_map() const {
return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<paddle::lite::fbs::opencl::proto::TuneCache_::TunePair>> *>(VT_TUNE_MAP);
}
flatbuffers::Vector<flatbuffers::Offset<paddle::lite::fbs::opencl::proto::TuneCache_::TunePair>> *mutable_tune_map() {
return GetPointer<flatbuffers::Vector<flatbuffers::Offset<paddle::lite::fbs::opencl::proto::TuneCache_::TunePair>> *>(VT_TUNE_MAP);
}
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
VerifyOffsetRequired(verifier, VT_TUNE_MAP) &&
verifier.VerifyVector(tune_map()) &&
verifier.VerifyVectorOfTables(tune_map()) &&
verifier.EndTable();
}
TuneCacheT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const;
void UnPackTo(TuneCacheT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const;
static flatbuffers::Offset<TuneCache> Pack(flatbuffers::FlatBufferBuilder &_fbb, const TuneCacheT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
};

struct TuneCacheBuilder {
typedef TuneCache Table;
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
void add_tune_map(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<paddle::lite::fbs::opencl::proto::TuneCache_::TunePair>>> tune_map) {
fbb_.AddOffset(TuneCache::VT_TUNE_MAP, tune_map);
}
explicit TuneCacheBuilder(flatbuffers::FlatBufferBuilder &_fbb)
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
TuneCacheBuilder &operator=(const TuneCacheBuilder &);
flatbuffers::Offset<TuneCache> Finish() {
const auto end = fbb_.EndTable(start_);
auto o = flatbuffers::Offset<TuneCache>(end);
fbb_.Required(o, TuneCache::VT_TUNE_MAP);
return o;
}
};

inline flatbuffers::Offset<TuneCache> CreateTuneCache(
flatbuffers::FlatBufferBuilder &_fbb,
flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<paddle::lite::fbs::opencl::proto::TuneCache_::TunePair>>> tune_map = 0) {
TuneCacheBuilder builder_(_fbb);
builder_.add_tune_map(tune_map);
return builder_.Finish();
}

inline flatbuffers::Offset<TuneCache> CreateTuneCacheDirect(
flatbuffers::FlatBufferBuilder &_fbb,
std::vector<flatbuffers::Offset<paddle::lite::fbs::opencl::proto::TuneCache_::TunePair>> *tune_map = nullptr) {
auto tune_map__ = tune_map ? _fbb.CreateVectorOfSortedTables<paddle::lite::fbs::opencl::proto::TuneCache_::TunePair>(tune_map) : 0;
return paddle::lite::fbs::opencl::proto::CreateTuneCache(
_fbb,
tune_map__);
}

flatbuffers::Offset<TuneCache> CreateTuneCache(flatbuffers::FlatBufferBuilder &_fbb, const TuneCacheT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);

namespace TuneCache_ {

inline TunePairT *TunePair::UnPack(const flatbuffers::resolver_function_t *_resolver) const {
std::unique_ptr<paddle::lite::fbs::opencl::proto::TuneCache_::TunePairT> _o = std::unique_ptr<paddle::lite::fbs::opencl::proto::TuneCache_::TunePairT>(new TunePairT());
UnPackTo(_o.get(), _resolver);
return _o.release();
}

inline void TunePair::UnPackTo(TunePairT *_o, const flatbuffers::resolver_function_t *_resolver) const {
(void)_o;
(void)_resolver;
{ auto _e = key(); if (_e) _o->key = _e->str(); }
{ auto _e = value(); if (_e) { _o->value.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->value[_i] = _e->Get(_i); } } }
}

inline flatbuffers::Offset<TunePair> TunePair::Pack(flatbuffers::FlatBufferBuilder &_fbb, const TunePairT* _o, const flatbuffers::rehasher_function_t *_rehasher) {
return CreateTunePair(_fbb, _o, _rehasher);
}

inline flatbuffers::Offset<TunePair> CreateTunePair(flatbuffers::FlatBufferBuilder &_fbb, const TunePairT *_o, const flatbuffers::rehasher_function_t *_rehasher) {
(void)_rehasher;
(void)_o;
struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const TunePairT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va;
auto _key = _fbb.CreateString(_o->key);
auto _value = _fbb.CreateVector(_o->value);
return paddle::lite::fbs::opencl::proto::TuneCache_::CreateTunePair(
_fbb,
_key,
_value);
}

} // namespace TuneCache_

inline TuneCacheT *TuneCache::UnPack(const flatbuffers::resolver_function_t *_resolver) const {
std::unique_ptr<paddle::lite::fbs::opencl::proto::TuneCacheT> _o = std::unique_ptr<paddle::lite::fbs::opencl::proto::TuneCacheT>(new TuneCacheT());
UnPackTo(_o.get(), _resolver);
return _o.release();
}

inline void TuneCache::UnPackTo(TuneCacheT *_o, const flatbuffers::resolver_function_t *_resolver) const {
(void)_o;
(void)_resolver;
{ auto _e = tune_map(); if (_e) { _o->tune_map.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->tune_map[_i] = std::unique_ptr<paddle::lite::fbs::opencl::proto::TuneCache_::TunePairT>(_e->Get(_i)->UnPack(_resolver)); } } }
}

inline flatbuffers::Offset<TuneCache> TuneCache::Pack(flatbuffers::FlatBufferBuilder &_fbb, const TuneCacheT* _o, const flatbuffers::rehasher_function_t *_rehasher) {
return CreateTuneCache(_fbb, _o, _rehasher);
}

inline flatbuffers::Offset<TuneCache> CreateTuneCache(flatbuffers::FlatBufferBuilder &_fbb, const TuneCacheT *_o, const flatbuffers::rehasher_function_t *_rehasher) {
(void)_rehasher;
(void)_o;
struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const TuneCacheT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va;
auto _tune_map = _fbb.CreateVector<flatbuffers::Offset<paddle::lite::fbs::opencl::proto::TuneCache_::TunePair>> (_o->tune_map.size(), [](size_t i, _VectorArgs *__va) { return CreateTunePair(*__va->__fbb, __va->__o->tune_map[i].get(), __va->__rehasher); }, &_va );
return paddle::lite::fbs::opencl::proto::CreateTuneCache(
_fbb,
_tune_map);
}

namespace TuneCache_ {

inline const flatbuffers::TypeTable *TunePairTypeTable() {
static const flatbuffers::TypeCode type_codes[] = {
{ flatbuffers::ET_STRING, 0, -1 },
{ flatbuffers::ET_INT, 1, -1 }
};
static const char * const names[] = {
"key",
"value"
};
static const flatbuffers::TypeTable tt = {
flatbuffers::ST_TABLE, 2, type_codes, nullptr, nullptr, names
};
return &tt;
}

} // namespace TuneCache_

inline const flatbuffers::TypeTable *TuneCacheTypeTable() {
static const flatbuffers::TypeCode type_codes[] = {
{ flatbuffers::ET_SEQUENCE, 1, 0 }
};
static const flatbuffers::TypeFunction type_refs[] = {
paddle::lite::fbs::opencl::proto::TuneCache_::TunePairTypeTable
};
static const char * const names[] = {
"tune_map"
};
static const flatbuffers::TypeTable tt = {
flatbuffers::ST_TABLE, 1, type_codes, type_refs, nullptr, names
};
return &tt;
}

inline const paddle::lite::fbs::opencl::proto::TuneCache *GetTuneCache(const void *buf) {
return flatbuffers::GetRoot<paddle::lite::fbs::opencl::proto::TuneCache>(buf);
}

inline const paddle::lite::fbs::opencl::proto::TuneCache *GetSizePrefixedTuneCache(const void *buf) {
return flatbuffers::GetSizePrefixedRoot<paddle::lite::fbs::opencl::proto::TuneCache>(buf);
}

inline TuneCache *GetMutableTuneCache(void *buf) {
return flatbuffers::GetMutableRoot<TuneCache>(buf);
}

inline bool VerifyTuneCacheBuffer(
flatbuffers::Verifier &verifier) {
return verifier.VerifyBuffer<paddle::lite::fbs::opencl::proto::TuneCache>(nullptr);
}

inline bool VerifySizePrefixedTuneCacheBuffer(
flatbuffers::Verifier &verifier) {
return verifier.VerifySizePrefixedBuffer<paddle::lite::fbs::opencl::proto::TuneCache>(nullptr);
}

inline void FinishTuneCacheBuffer(
flatbuffers::FlatBufferBuilder &fbb,
flatbuffers::Offset<paddle::lite::fbs::opencl::proto::TuneCache> root) {
fbb.Finish(root);
}

inline void FinishSizePrefixedTuneCacheBuffer(
flatbuffers::FlatBufferBuilder &fbb,
flatbuffers::Offset<paddle::lite::fbs::opencl::proto::TuneCache> root) {
fbb.FinishSizePrefixed(root);
}

inline std::unique_ptr<paddle::lite::fbs::opencl::proto::TuneCacheT> UnPackTuneCache(
const void *buf,
const flatbuffers::resolver_function_t *res = nullptr) {
return std::unique_ptr<paddle::lite::fbs::opencl::proto::TuneCacheT>(GetTuneCache(buf)->UnPack(res));
}

inline std::unique_ptr<paddle::lite::fbs::opencl::proto::TuneCacheT> UnPackSizePrefixedTuneCache(
const void *buf,
const flatbuffers::resolver_function_t *res = nullptr) {
return std::unique_ptr<paddle::lite::fbs::opencl::proto::TuneCacheT>(GetSizePrefixedTuneCache(buf)->UnPack(res));
}

} // namespace proto
} // namespace opencl
} // namespace fbs
} // namespace lite
} // namespace paddle

#endif // FLATBUFFERS_GENERATED_TUNECACHE_PADDLE_LITE_FBS_OPENCL_PROTO_H_
Loading