From 771ff10db020b98ec138ef20fb503b1469e3633f Mon Sep 17 00:00:00 2001 From: Hecmay Date: Thu, 24 Aug 2023 07:45:34 -0400 Subject: [PATCH 1/8] Add Taskflow submodule --- .gitmodules | 3 +++ externals/taskflow | 1 + 2 files changed, 4 insertions(+) create mode 160000 externals/taskflow diff --git a/.gitmodules b/.gitmodules index 57753350..92c0c215 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,3 +4,6 @@ [submodule "externals/llvm-project"] path = externals/llvm-project url = https://github.com/llvm/llvm-project.git +[submodule "externals/taskflow"] + path = externals/taskflow + url = https://github.com/taskflow/taskflow.git diff --git a/externals/taskflow b/externals/taskflow new file mode 160000 index 00000000..9316d989 --- /dev/null +++ b/externals/taskflow @@ -0,0 +1 @@ +Subproject commit 9316d98937e992968f1fb3a5836bf3500f756df7 From fd302666d656343ee014d5133f49d0a9d58d4884 Mon Sep 17 00:00:00 2001 From: Hecmay Date: Thu, 24 Aug 2023 08:17:23 -0400 Subject: [PATCH 2/8] Update cmakes --- CMakeLists.txt | 1 + tools/hcl-opt/CMakeLists.txt | 1 + tools/hcl-opt/hcl-opt.cpp | 5 ++++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a5d200ce..93b4124e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -45,6 +45,7 @@ include(AddLLVM) include(AddMLIR) include(HandleLLVMOptions) +include_directories(${PROJECT_SOURCE_DIR}/externals/taskflow) include_directories(${LLVM_INCLUDE_DIRS}) include_directories(${MLIR_INCLUDE_DIRS}) include_directories(${PROJECT_SOURCE_DIR}/include) diff --git a/tools/hcl-opt/CMakeLists.txt b/tools/hcl-opt/CMakeLists.txt index 6f0f06a0..ed9474a8 100644 --- a/tools/hcl-opt/CMakeLists.txt +++ b/tools/hcl-opt/CMakeLists.txt @@ -27,6 +27,7 @@ set(LIBS add_llvm_executable(hcl-opt hcl-opt.cpp) llvm_update_compile_flags(hcl-opt) +target_compile_options(hcl-opt PRIVATE -fexceptions) target_link_libraries(hcl-opt PRIVATE ${LIBS}) mlir_check_all_link_libraries(hcl-opt) diff --git a/tools/hcl-opt/hcl-opt.cpp b/tools/hcl-opt/hcl-opt.cpp index 230ff8dc..2cd915cf 100644 --- a/tools/hcl-opt/hcl-opt.cpp +++ b/tools/hcl-opt/hcl-opt.cpp @@ -36,6 +36,7 @@ #include "hcl/Support/Utils.h" #include "hcl/Transforms/Passes.h" +#include "taskflow/taskflow.hpp" #include static llvm::cl::opt inputFilename(llvm::cl::Positional, @@ -371,8 +372,10 @@ int main(int argc, char **argv) { outfile->os() << "\n"; // run JiT - if (runJiT) + if (runJiT) { + tf::Executor executor; return runJiTCompiler(*module); + } return 0; } \ No newline at end of file From 106ee3c9510b9a0e6f4a3478fd0c63f7978e3d7e Mon Sep 17 00:00:00 2001 From: Hecmay Date: Tue, 29 Aug 2023 14:02:08 -0400 Subject: [PATCH 3/8] make taskflow backend optional --- lib/Bindings/Python/HCLModule.cpp | 22 ++++++++++++++++++++++ tools/hcl-opt/hcl-opt.cpp | 17 +++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/lib/Bindings/Python/HCLModule.cpp b/lib/Bindings/Python/HCLModule.cpp index ecb00c83..cc363006 100644 --- a/lib/Bindings/Python/HCLModule.cpp +++ b/lib/Bindings/Python/HCLModule.cpp @@ -157,6 +157,23 @@ static bool memRefDCE(MlirModule &mlir_mod) { return applyMemRefDCE(mod); } +//===----------------------------------------------------------------------===// +// TaskFlow APIs +//===----------------------------------------------------------------------===// +#ifdef TASKFLOW +// runTaskFlowExecutor takes a map of names to MLIR modules and a dependncy graph that specifies the inter-module dependencies. +static bool runTaskFlowExecutor( + std::map &mlir_mods, + std::map> &dependency_graph) { + std::map mods; + for (auto &mod : mlir_mods) { + mods[mod.first] = unwrap(mod.second); + } + return applyTaskFlowExecutor(mods, dependency_graph); +} +#endif + + //===----------------------------------------------------------------------===// // HCL Python module definition //===----------------------------------------------------------------------===// @@ -250,6 +267,11 @@ PYBIND11_MODULE(_hcl, m) { hcl_m.def("lower_anywidth_int", &lowerAnyWidthInteger); hcl_m.def("move_return_to_input", &moveReturnToInput); +#ifdef TASKFLOW + // TaskFlow backend APIs. + hcl_m.def("lower_hcl_to_taskflow", &runTaskFlowExecutor); +#endif + // Lowering APIs. hcl_m.def("lower_composite_type", &lowerCompositeType); hcl_m.def("lower_bit_ops", &lowerBitOps); diff --git a/tools/hcl-opt/hcl-opt.cpp b/tools/hcl-opt/hcl-opt.cpp index 2cd915cf..3bf31eb2 100644 --- a/tools/hcl-opt/hcl-opt.cpp +++ b/tools/hcl-opt/hcl-opt.cpp @@ -36,7 +36,10 @@ #include "hcl/Support/Utils.h" #include "hcl/Transforms/Passes.h" +#ifdef TASKFLOW #include "taskflow/taskflow.hpp" +#endif + #include static llvm::cl::opt inputFilename(llvm::cl::Positional, @@ -373,8 +376,22 @@ int main(int argc, char **argv) { // run JiT if (runJiT) { +#ifdef TASKFLOW + int ret = 0; tf::Executor executor; + tf::Taskflow taskflow; + auto task = taskflow.emplace( + [&] () { + ret = runJiTCompiler(*module); + } + ); + + task.name("top"); + executor.run(taskflow).wait(); + return ret; +#else return runJiTCompiler(*module); +#endif } return 0; From 2356d31825f4b04cc9e1769b41f851235c4847b1 Mon Sep 17 00:00:00 2001 From: Hecmay Date: Tue, 29 Aug 2023 14:32:45 -0400 Subject: [PATCH 4/8] format source --- lib/Bindings/Python/HCLModule.cpp | 4 ++-- tools/hcl-opt/hcl-opt.cpp | 6 +----- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/lib/Bindings/Python/HCLModule.cpp b/lib/Bindings/Python/HCLModule.cpp index cc363006..9d31964a 100644 --- a/lib/Bindings/Python/HCLModule.cpp +++ b/lib/Bindings/Python/HCLModule.cpp @@ -161,7 +161,8 @@ static bool memRefDCE(MlirModule &mlir_mod) { // TaskFlow APIs //===----------------------------------------------------------------------===// #ifdef TASKFLOW -// runTaskFlowExecutor takes a map of names to MLIR modules and a dependncy graph that specifies the inter-module dependencies. +// runTaskFlowExecutor takes a map of names to MLIR modules and a dependncy +// graph that specifies the inter-module dependencies. static bool runTaskFlowExecutor( std::map &mlir_mods, std::map> &dependency_graph) { @@ -173,7 +174,6 @@ static bool runTaskFlowExecutor( } #endif - //===----------------------------------------------------------------------===// // HCL Python module definition //===----------------------------------------------------------------------===// diff --git a/tools/hcl-opt/hcl-opt.cpp b/tools/hcl-opt/hcl-opt.cpp index 3bf31eb2..730386aa 100644 --- a/tools/hcl-opt/hcl-opt.cpp +++ b/tools/hcl-opt/hcl-opt.cpp @@ -380,11 +380,7 @@ int main(int argc, char **argv) { int ret = 0; tf::Executor executor; tf::Taskflow taskflow; - auto task = taskflow.emplace( - [&] () { - ret = runJiTCompiler(*module); - } - ); + auto task = taskflow.emplace([&]() { ret = runJiTCompiler(*module); }); task.name("top"); executor.run(taskflow).wait(); From c401982d5660fe2e1970b2c5e51280b873221b5f Mon Sep 17 00:00:00 2001 From: Hecmay Date: Tue, 29 Aug 2023 14:50:18 -0400 Subject: [PATCH 5/8] add protobuf --- lib/Target/CMakeLists.txt | 4 + lib/Target/TaskFlow/IPInputs.cc | 653 +++++++++++++++++++++++++++ lib/Target/TaskFlow/IPInputs.h | 688 +++++++++++++++++++++++++++++ lib/Target/TaskFlow/IPInputs.proto | 15 + 4 files changed, 1360 insertions(+) create mode 100644 lib/Target/TaskFlow/IPInputs.cc create mode 100644 lib/Target/TaskFlow/IPInputs.h create mode 100644 lib/Target/TaskFlow/IPInputs.proto diff --git a/lib/Target/CMakeLists.txt b/lib/Target/CMakeLists.txt index 33d502cb..e5f85dab 100644 --- a/lib/Target/CMakeLists.txt +++ b/lib/Target/CMakeLists.txt @@ -4,3 +4,7 @@ if (OPENSCOP) add_subdirectory(OpenSCoP) endif() + +if (TASKFLOW) + add_subdirectory(TaskFlow) +endif() \ No newline at end of file diff --git a/lib/Target/TaskFlow/IPInputs.cc b/lib/Target/TaskFlow/IPInputs.cc new file mode 100644 index 00000000..52036711 --- /dev/null +++ b/lib/Target/TaskFlow/IPInputs.cc @@ -0,0 +1,653 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: ip.proto + +#include "IPInputs.pb.h" + +#include + +#include +#include +#include +#include +#include +#include +#include +// @@protoc_insertion_point(includes) +#include + +PROTOBUF_PRAGMA_INIT_SEG +constexpr Param::Param( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : name_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , data_type_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , bit_width_(0) + , int_width_(0) + , frac_width_(0) + , value_(0){} +struct ParamDefaultTypeInternal { + constexpr ParamDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~ParamDefaultTypeInternal() {} + union { + Param _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT ParamDefaultTypeInternal _Param_default_instance_; +constexpr ObjectList::ObjectList( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : objects_(){} +struct ObjectListDefaultTypeInternal { + constexpr ObjectListDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~ObjectListDefaultTypeInternal() {} + union { + ObjectList _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT ObjectListDefaultTypeInternal _ObjectList_default_instance_; +static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_ip_2eproto[2]; +static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_ip_2eproto = nullptr; +static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_ip_2eproto = nullptr; + +const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_ip_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { + ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::Param, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + PROTOBUF_FIELD_OFFSET(::Param, name_), + PROTOBUF_FIELD_OFFSET(::Param, data_type_), + PROTOBUF_FIELD_OFFSET(::Param, bit_width_), + PROTOBUF_FIELD_OFFSET(::Param, int_width_), + PROTOBUF_FIELD_OFFSET(::Param, frac_width_), + PROTOBUF_FIELD_OFFSET(::Param, value_), + ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::ObjectList, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + PROTOBUF_FIELD_OFFSET(::ObjectList, objects_), +}; +static const ::PROTOBUF_NAMESPACE_ID::internal::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { + { 0, -1, sizeof(::Param)}, + { 11, -1, sizeof(::ObjectList)}, +}; + +static ::PROTOBUF_NAMESPACE_ID::Message const * const file_default_instances[] = { + reinterpret_cast(&::_Param_default_instance_), + reinterpret_cast(&::_ObjectList_default_instance_), +}; + +const char descriptor_table_protodef_ip_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = + "\n\010ip.proto\"q\n\005Param\022\014\n\004name\030\001 \001(\t\022\021\n\tdat" + "a_type\030\002 \001(\t\022\021\n\tbit_width\030\003 \001(\005\022\021\n\tint_w" + "idth\030\004 \001(\005\022\022\n\nfrac_width\030\005 \001(\005\022\r\n\005value\030" + "\006 \001(\002\"%\n\nObjectList\022\027\n\007objects\030\001 \003(\0132\006.P" + "aramb\006proto3" + ; +static ::PROTOBUF_NAMESPACE_ID::internal::once_flag descriptor_table_ip_2eproto_once; +const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_ip_2eproto = { + false, false, 172, descriptor_table_protodef_ip_2eproto, "ip.proto", + &descriptor_table_ip_2eproto_once, nullptr, 0, 2, + schemas, file_default_instances, TableStruct_ip_2eproto::offsets, + file_level_metadata_ip_2eproto, file_level_enum_descriptors_ip_2eproto, file_level_service_descriptors_ip_2eproto, +}; +PROTOBUF_ATTRIBUTE_WEAK ::PROTOBUF_NAMESPACE_ID::Metadata +descriptor_table_ip_2eproto_metadata_getter(int index) { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&descriptor_table_ip_2eproto); + return descriptor_table_ip_2eproto.file_level_metadata[index]; +} + +// Force running AddDescriptors() at dynamic initialization time. +PROTOBUF_ATTRIBUTE_INIT_PRIORITY static ::PROTOBUF_NAMESPACE_ID::internal::AddDescriptorsRunner dynamic_init_dummy_ip_2eproto(&descriptor_table_ip_2eproto); + +// =================================================================== + +class Param::_Internal { + public: +}; + +Param::Param(::PROTOBUF_NAMESPACE_ID::Arena* arena) + : ::PROTOBUF_NAMESPACE_ID::Message(arena) { + SharedCtor(); + RegisterArenaDtor(arena); + // @@protoc_insertion_point(arena_constructor:Param) +} +Param::Param(const Param& from) + : ::PROTOBUF_NAMESPACE_ID::Message() { + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + if (!from._internal_name().empty()) { + name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(), + GetArena()); + } + data_type_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + if (!from._internal_data_type().empty()) { + data_type_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_data_type(), + GetArena()); + } + ::memcpy(&bit_width_, &from.bit_width_, + static_cast(reinterpret_cast(&value_) - + reinterpret_cast(&bit_width_)) + sizeof(value_)); + // @@protoc_insertion_point(copy_constructor:Param) +} + +void Param::SharedCtor() { +name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +data_type_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +::memset(reinterpret_cast(this) + static_cast( + reinterpret_cast(&bit_width_) - reinterpret_cast(this)), + 0, static_cast(reinterpret_cast(&value_) - + reinterpret_cast(&bit_width_)) + sizeof(value_)); +} + +Param::~Param() { + // @@protoc_insertion_point(destructor:Param) + SharedDtor(); + _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +void Param::SharedDtor() { + GOOGLE_DCHECK(GetArena() == nullptr); + name_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + data_type_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} + +void Param::ArenaDtor(void* object) { + Param* _this = reinterpret_cast< Param* >(object); + (void)_this; +} +void Param::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void Param::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void Param::Clear() { +// @@protoc_insertion_point(message_clear_start:Param) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + name_.ClearToEmpty(); + data_type_.ClearToEmpty(); + ::memset(&bit_width_, 0, static_cast( + reinterpret_cast(&value_) - + reinterpret_cast(&bit_width_)) + sizeof(value_)); + _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +const char* Param::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + ::PROTOBUF_NAMESPACE_ID::uint32 tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + CHK_(ptr); + switch (tag >> 3) { + // string name = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { + auto str = _internal_mutable_name(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "Param.name")); + CHK_(ptr); + } else goto handle_unusual; + continue; + // string data_type = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) { + auto str = _internal_mutable_data_type(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "Param.data_type")); + CHK_(ptr); + } else goto handle_unusual; + continue; + // int32 bit_width = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 24)) { + bit_width_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else goto handle_unusual; + continue; + // int32 int_width = 4; + case 4: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 32)) { + int_width_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else goto handle_unusual; + continue; + // int32 frac_width = 5; + case 5: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 40)) { + frac_width_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else goto handle_unusual; + continue; + // float value = 6; + case 6: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 53)) { + value_ = ::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad(ptr); + ptr += sizeof(float); + } else goto handle_unusual; + continue; + default: { + handle_unusual: + if ((tag & 7) == 4 || tag == 0) { + ctx->SetLastTag(tag); + goto success; + } + ptr = UnknownFieldParse(tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); + continue; + } + } // switch + } // while +success: + return ptr; +failure: + ptr = nullptr; + goto success; +#undef CHK_ +} + +::PROTOBUF_NAMESPACE_ID::uint8* Param::_InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:Param) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + // string name = 1; + if (this->name().size() > 0) { + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( + this->_internal_name().data(), static_cast(this->_internal_name().length()), + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, + "Param.name"); + target = stream->WriteStringMaybeAliased( + 1, this->_internal_name(), target); + } + + // string data_type = 2; + if (this->data_type().size() > 0) { + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( + this->_internal_data_type().data(), static_cast(this->_internal_data_type().length()), + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, + "Param.data_type"); + target = stream->WriteStringMaybeAliased( + 2, this->_internal_data_type(), target); + } + + // int32 bit_width = 3; + if (this->bit_width() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(3, this->_internal_bit_width(), target); + } + + // int32 int_width = 4; + if (this->int_width() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(4, this->_internal_int_width(), target); + } + + // int32 frac_width = 5; + if (this->frac_width() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(5, this->_internal_frac_width(), target); + } + + // float value = 6; + if (!(this->value() <= 0 && this->value() >= 0)) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteFloatToArray(6, this->_internal_value(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:Param) + return target; +} + +size_t Param::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:Param) + size_t total_size = 0; + + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // string name = 1; + if (this->name().size() > 0) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_name()); + } + + // string data_type = 2; + if (this->data_type().size() > 0) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_data_type()); + } + + // int32 bit_width = 3; + if (this->bit_width() != 0) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size( + this->_internal_bit_width()); + } + + // int32 int_width = 4; + if (this->int_width() != 0) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size( + this->_internal_int_width()); + } + + // int32 frac_width = 5; + if (this->frac_width() != 0) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size( + this->_internal_frac_width()); + } + + // float value = 6; + if (!(this->value() <= 0 && this->value() >= 0)) { + total_size += 1 + 4; + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( + _internal_metadata_, total_size, &_cached_size_); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void Param::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { +// @@protoc_insertion_point(generalized_merge_from_start:Param) + GOOGLE_DCHECK_NE(&from, this); + const Param* source = + ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated( + &from); + if (source == nullptr) { + // @@protoc_insertion_point(generalized_merge_from_cast_fail:Param) + ::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this); + } else { + // @@protoc_insertion_point(generalized_merge_from_cast_success:Param) + MergeFrom(*source); + } +} + +void Param::MergeFrom(const Param& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:Param) + GOOGLE_DCHECK_NE(&from, this); + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + if (from.name().size() > 0) { + _internal_set_name(from._internal_name()); + } + if (from.data_type().size() > 0) { + _internal_set_data_type(from._internal_data_type()); + } + if (from.bit_width() != 0) { + _internal_set_bit_width(from._internal_bit_width()); + } + if (from.int_width() != 0) { + _internal_set_int_width(from._internal_int_width()); + } + if (from.frac_width() != 0) { + _internal_set_frac_width(from._internal_frac_width()); + } + if (!(from.value() <= 0 && from.value() >= 0)) { + _internal_set_value(from._internal_value()); + } +} + +void Param::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { +// @@protoc_insertion_point(generalized_copy_from_start:Param) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void Param::CopyFrom(const Param& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:Param) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool Param::IsInitialized() const { + return true; +} + +void Param::InternalSwap(Param* other) { + using std::swap; + _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_); + name_.Swap(&other->name_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); + data_type_.Swap(&other->data_type_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(Param, value_) + + sizeof(Param::value_) + - PROTOBUF_FIELD_OFFSET(Param, bit_width_)>( + reinterpret_cast(&bit_width_), + reinterpret_cast(&other->bit_width_)); +} + +::PROTOBUF_NAMESPACE_ID::Metadata Param::GetMetadata() const { + return GetMetadataStatic(); +} + + +// =================================================================== + +class ObjectList::_Internal { + public: +}; + +ObjectList::ObjectList(::PROTOBUF_NAMESPACE_ID::Arena* arena) + : ::PROTOBUF_NAMESPACE_ID::Message(arena), + objects_(arena) { + SharedCtor(); + RegisterArenaDtor(arena); + // @@protoc_insertion_point(arena_constructor:ObjectList) +} +ObjectList::ObjectList(const ObjectList& from) + : ::PROTOBUF_NAMESPACE_ID::Message(), + objects_(from.objects_) { + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + // @@protoc_insertion_point(copy_constructor:ObjectList) +} + +void ObjectList::SharedCtor() { +} + +ObjectList::~ObjectList() { + // @@protoc_insertion_point(destructor:ObjectList) + SharedDtor(); + _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +void ObjectList::SharedDtor() { + GOOGLE_DCHECK(GetArena() == nullptr); +} + +void ObjectList::ArenaDtor(void* object) { + ObjectList* _this = reinterpret_cast< ObjectList* >(object); + (void)_this; +} +void ObjectList::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void ObjectList::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void ObjectList::Clear() { +// @@protoc_insertion_point(message_clear_start:ObjectList) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + objects_.Clear(); + _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +const char* ObjectList::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + ::PROTOBUF_NAMESPACE_ID::uint32 tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + CHK_(ptr); + switch (tag >> 3) { + // repeated .Param objects = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { + ptr -= 1; + do { + ptr += 1; + ptr = ctx->ParseMessage(_internal_add_objects(), ptr); + CHK_(ptr); + if (!ctx->DataAvailable(ptr)) break; + } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<10>(ptr)); + } else goto handle_unusual; + continue; + default: { + handle_unusual: + if ((tag & 7) == 4 || tag == 0) { + ctx->SetLastTag(tag); + goto success; + } + ptr = UnknownFieldParse(tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); + continue; + } + } // switch + } // while +success: + return ptr; +failure: + ptr = nullptr; + goto success; +#undef CHK_ +} + +::PROTOBUF_NAMESPACE_ID::uint8* ObjectList::_InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:ObjectList) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + // repeated .Param objects = 1; + for (unsigned int i = 0, + n = static_cast(this->_internal_objects_size()); i < n; i++) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage(1, this->_internal_objects(i), target, stream); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:ObjectList) + return target; +} + +size_t ObjectList::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:ObjectList) + size_t total_size = 0; + + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // repeated .Param objects = 1; + total_size += 1UL * this->_internal_objects_size(); + for (const auto& msg : this->objects_) { + total_size += + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( + _internal_metadata_, total_size, &_cached_size_); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void ObjectList::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { +// @@protoc_insertion_point(generalized_merge_from_start:ObjectList) + GOOGLE_DCHECK_NE(&from, this); + const ObjectList* source = + ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated( + &from); + if (source == nullptr) { + // @@protoc_insertion_point(generalized_merge_from_cast_fail:ObjectList) + ::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this); + } else { + // @@protoc_insertion_point(generalized_merge_from_cast_success:ObjectList) + MergeFrom(*source); + } +} + +void ObjectList::MergeFrom(const ObjectList& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:ObjectList) + GOOGLE_DCHECK_NE(&from, this); + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + objects_.MergeFrom(from.objects_); +} + +void ObjectList::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { +// @@protoc_insertion_point(generalized_copy_from_start:ObjectList) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void ObjectList::CopyFrom(const ObjectList& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:ObjectList) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool ObjectList::IsInitialized() const { + return true; +} + +void ObjectList::InternalSwap(ObjectList* other) { + using std::swap; + _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_); + objects_.InternalSwap(&other->objects_); +} + +::PROTOBUF_NAMESPACE_ID::Metadata ObjectList::GetMetadata() const { + return GetMetadataStatic(); +} + + +// @@protoc_insertion_point(namespace_scope) +PROTOBUF_NAMESPACE_OPEN +template<> PROTOBUF_NOINLINE ::Param* Arena::CreateMaybeMessage< ::Param >(Arena* arena) { + return Arena::CreateMessageInternal< ::Param >(arena); +} +template<> PROTOBUF_NOINLINE ::ObjectList* Arena::CreateMaybeMessage< ::ObjectList >(Arena* arena) { + return Arena::CreateMessageInternal< ::ObjectList >(arena); +} +PROTOBUF_NAMESPACE_CLOSE + +// @@protoc_insertion_point(global_scope) +#include diff --git a/lib/Target/TaskFlow/IPInputs.h b/lib/Target/TaskFlow/IPInputs.h new file mode 100644 index 00000000..fcc6ccc5 --- /dev/null +++ b/lib/Target/TaskFlow/IPInputs.h @@ -0,0 +1,688 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: ip.proto + +#ifndef GOOGLE_PROTOBUF_INCLUDED_ip_2eproto +#define GOOGLE_PROTOBUF_INCLUDED_ip_2eproto + +#include +#include + +#include +#if PROTOBUF_VERSION < 3015000 +#error This file was generated by a newer version of protoc which is +#error incompatible with your Protocol Buffer headers. Please update +#error your headers. +#endif +#if 3015008 < PROTOBUF_MIN_PROTOC_VERSION +#error This file was generated by an older version of protoc which is +#error incompatible with your Protocol Buffer headers. Please +#error regenerate this file with a newer version of protoc. +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // IWYU pragma: export +#include // IWYU pragma: export +#include +// @@protoc_insertion_point(includes) +#include +#define PROTOBUF_INTERNAL_EXPORT_ip_2eproto +PROTOBUF_NAMESPACE_OPEN +namespace internal { +class AnyMetadata; +} // namespace internal +PROTOBUF_NAMESPACE_CLOSE + +// Internal implementation detail -- do not use these members. +struct TableStruct_ip_2eproto { + static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTableField entries[] + PROTOBUF_SECTION_VARIABLE(protodesc_cold); + static const ::PROTOBUF_NAMESPACE_ID::internal::AuxiliaryParseTableField aux[] + PROTOBUF_SECTION_VARIABLE(protodesc_cold); + static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTable schema[2] + PROTOBUF_SECTION_VARIABLE(protodesc_cold); + static const ::PROTOBUF_NAMESPACE_ID::internal::FieldMetadata field_metadata[]; + static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[]; + static const ::PROTOBUF_NAMESPACE_ID::uint32 offsets[]; +}; +extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_ip_2eproto; +::PROTOBUF_NAMESPACE_ID::Metadata descriptor_table_ip_2eproto_metadata_getter(int index); +class ObjectList; +struct ObjectListDefaultTypeInternal; +extern ObjectListDefaultTypeInternal _ObjectList_default_instance_; +class Param; +struct ParamDefaultTypeInternal; +extern ParamDefaultTypeInternal _Param_default_instance_; +PROTOBUF_NAMESPACE_OPEN +template<> ::ObjectList* Arena::CreateMaybeMessage<::ObjectList>(Arena*); +template<> ::Param* Arena::CreateMaybeMessage<::Param>(Arena*); +PROTOBUF_NAMESPACE_CLOSE + +// =================================================================== + +class Param PROTOBUF_FINAL : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:Param) */ { + public: + inline Param() : Param(nullptr) {} + virtual ~Param(); + explicit constexpr Param(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + Param(const Param& from); + Param(Param&& from) noexcept + : Param() { + *this = ::std::move(from); + } + + inline Param& operator=(const Param& from) { + CopyFrom(from); + return *this; + } + inline Param& operator=(Param&& from) noexcept { + if (GetArena() == from.GetArena()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return GetMetadataStatic().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return GetMetadataStatic().reflection; + } + static const Param& default_instance() { + return *internal_default_instance(); + } + static inline const Param* internal_default_instance() { + return reinterpret_cast( + &_Param_default_instance_); + } + static constexpr int kIndexInFileMessages = + 0; + + friend void swap(Param& a, Param& b) { + a.Swap(&b); + } + inline void Swap(Param* other) { + if (other == this) return; + if (GetArena() == other->GetArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(Param* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline Param* New() const final { + return CreateMaybeMessage(nullptr); + } + + Param* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void CopyFrom(const Param& from); + void MergeFrom(const Param& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + inline void SharedCtor(); + inline void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(Param* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "Param"; + } + protected: + explicit Param(::PROTOBUF_NAMESPACE_ID::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + private: + static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { + return ::descriptor_table_ip_2eproto_metadata_getter(kIndexInFileMessages); + } + + public: + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kNameFieldNumber = 1, + kDataTypeFieldNumber = 2, + kBitWidthFieldNumber = 3, + kIntWidthFieldNumber = 4, + kFracWidthFieldNumber = 5, + kValueFieldNumber = 6, + }; + // string name = 1; + void clear_name(); + const std::string& name() const; + void set_name(const std::string& value); + void set_name(std::string&& value); + void set_name(const char* value); + void set_name(const char* value, size_t size); + std::string* mutable_name(); + std::string* release_name(); + void set_allocated_name(std::string* name); + private: + const std::string& _internal_name() const; + void _internal_set_name(const std::string& value); + std::string* _internal_mutable_name(); + public: + + // string data_type = 2; + void clear_data_type(); + const std::string& data_type() const; + void set_data_type(const std::string& value); + void set_data_type(std::string&& value); + void set_data_type(const char* value); + void set_data_type(const char* value, size_t size); + std::string* mutable_data_type(); + std::string* release_data_type(); + void set_allocated_data_type(std::string* data_type); + private: + const std::string& _internal_data_type() const; + void _internal_set_data_type(const std::string& value); + std::string* _internal_mutable_data_type(); + public: + + // int32 bit_width = 3; + void clear_bit_width(); + ::PROTOBUF_NAMESPACE_ID::int32 bit_width() const; + void set_bit_width(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_bit_width() const; + void _internal_set_bit_width(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // int32 int_width = 4; + void clear_int_width(); + ::PROTOBUF_NAMESPACE_ID::int32 int_width() const; + void set_int_width(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_int_width() const; + void _internal_set_int_width(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // int32 frac_width = 5; + void clear_frac_width(); + ::PROTOBUF_NAMESPACE_ID::int32 frac_width() const; + void set_frac_width(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_frac_width() const; + void _internal_set_frac_width(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // float value = 6; + void clear_value(); + float value() const; + void set_value(float value); + private: + float _internal_value() const; + void _internal_set_value(float value); + public: + + // @@protoc_insertion_point(class_scope:Param) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr name_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr data_type_; + ::PROTOBUF_NAMESPACE_ID::int32 bit_width_; + ::PROTOBUF_NAMESPACE_ID::int32 int_width_; + ::PROTOBUF_NAMESPACE_ID::int32 frac_width_; + float value_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_ip_2eproto; +}; +// ------------------------------------------------------------------- + +class ObjectList PROTOBUF_FINAL : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:ObjectList) */ { + public: + inline ObjectList() : ObjectList(nullptr) {} + virtual ~ObjectList(); + explicit constexpr ObjectList(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + ObjectList(const ObjectList& from); + ObjectList(ObjectList&& from) noexcept + : ObjectList() { + *this = ::std::move(from); + } + + inline ObjectList& operator=(const ObjectList& from) { + CopyFrom(from); + return *this; + } + inline ObjectList& operator=(ObjectList&& from) noexcept { + if (GetArena() == from.GetArena()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return GetMetadataStatic().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return GetMetadataStatic().reflection; + } + static const ObjectList& default_instance() { + return *internal_default_instance(); + } + static inline const ObjectList* internal_default_instance() { + return reinterpret_cast( + &_ObjectList_default_instance_); + } + static constexpr int kIndexInFileMessages = + 1; + + friend void swap(ObjectList& a, ObjectList& b) { + a.Swap(&b); + } + inline void Swap(ObjectList* other) { + if (other == this) return; + if (GetArena() == other->GetArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(ObjectList* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline ObjectList* New() const final { + return CreateMaybeMessage(nullptr); + } + + ObjectList* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void CopyFrom(const ObjectList& from); + void MergeFrom(const ObjectList& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + inline void SharedCtor(); + inline void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(ObjectList* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "ObjectList"; + } + protected: + explicit ObjectList(::PROTOBUF_NAMESPACE_ID::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + private: + static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { + return ::descriptor_table_ip_2eproto_metadata_getter(kIndexInFileMessages); + } + + public: + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kObjectsFieldNumber = 1, + }; + // repeated .Param objects = 1; + int objects_size() const; + private: + int _internal_objects_size() const; + public: + void clear_objects(); + ::Param* mutable_objects(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::Param >* + mutable_objects(); + private: + const ::Param& _internal_objects(int index) const; + ::Param* _internal_add_objects(); + public: + const ::Param& objects(int index) const; + ::Param* add_objects(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::Param >& + objects() const; + + // @@protoc_insertion_point(class_scope:ObjectList) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::Param > objects_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_ip_2eproto; +}; +// =================================================================== + + +// =================================================================== + +#ifdef __GNUC__ + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wstrict-aliasing" +#endif // __GNUC__ +// Param + +// string name = 1; +inline void Param::clear_name() { + name_.ClearToEmpty(); +} +inline const std::string& Param::name() const { + // @@protoc_insertion_point(field_get:Param.name) + return _internal_name(); +} +inline void Param::set_name(const std::string& value) { + _internal_set_name(value); + // @@protoc_insertion_point(field_set:Param.name) +} +inline std::string* Param::mutable_name() { + // @@protoc_insertion_point(field_mutable:Param.name) + return _internal_mutable_name(); +} +inline const std::string& Param::_internal_name() const { + return name_.Get(); +} +inline void Param::_internal_set_name(const std::string& value) { + + name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArena()); +} +inline void Param::set_name(std::string&& value) { + + name_.Set( + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, ::std::move(value), GetArena()); + // @@protoc_insertion_point(field_set_rvalue:Param.name) +} +inline void Param::set_name(const char* value) { + GOOGLE_DCHECK(value != nullptr); + + name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, ::std::string(value), GetArena()); + // @@protoc_insertion_point(field_set_char:Param.name) +} +inline void Param::set_name(const char* value, + size_t size) { + + name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, ::std::string( + reinterpret_cast(value), size), GetArena()); + // @@protoc_insertion_point(field_set_pointer:Param.name) +} +inline std::string* Param::_internal_mutable_name() { + + return name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena()); +} +inline std::string* Param::release_name() { + // @@protoc_insertion_point(field_release:Param.name) + return name_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); +} +inline void Param::set_allocated_name(std::string* name) { + if (name != nullptr) { + + } else { + + } + name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name, + GetArena()); + // @@protoc_insertion_point(field_set_allocated:Param.name) +} + +// string data_type = 2; +inline void Param::clear_data_type() { + data_type_.ClearToEmpty(); +} +inline const std::string& Param::data_type() const { + // @@protoc_insertion_point(field_get:Param.data_type) + return _internal_data_type(); +} +inline void Param::set_data_type(const std::string& value) { + _internal_set_data_type(value); + // @@protoc_insertion_point(field_set:Param.data_type) +} +inline std::string* Param::mutable_data_type() { + // @@protoc_insertion_point(field_mutable:Param.data_type) + return _internal_mutable_data_type(); +} +inline const std::string& Param::_internal_data_type() const { + return data_type_.Get(); +} +inline void Param::_internal_set_data_type(const std::string& value) { + + data_type_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArena()); +} +inline void Param::set_data_type(std::string&& value) { + + data_type_.Set( + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, ::std::move(value), GetArena()); + // @@protoc_insertion_point(field_set_rvalue:Param.data_type) +} +inline void Param::set_data_type(const char* value) { + GOOGLE_DCHECK(value != nullptr); + + data_type_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, ::std::string(value), GetArena()); + // @@protoc_insertion_point(field_set_char:Param.data_type) +} +inline void Param::set_data_type(const char* value, + size_t size) { + + data_type_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, ::std::string( + reinterpret_cast(value), size), GetArena()); + // @@protoc_insertion_point(field_set_pointer:Param.data_type) +} +inline std::string* Param::_internal_mutable_data_type() { + + return data_type_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena()); +} +inline std::string* Param::release_data_type() { + // @@protoc_insertion_point(field_release:Param.data_type) + return data_type_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); +} +inline void Param::set_allocated_data_type(std::string* data_type) { + if (data_type != nullptr) { + + } else { + + } + data_type_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), data_type, + GetArena()); + // @@protoc_insertion_point(field_set_allocated:Param.data_type) +} + +// int32 bit_width = 3; +inline void Param::clear_bit_width() { + bit_width_ = 0; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 Param::_internal_bit_width() const { + return bit_width_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 Param::bit_width() const { + // @@protoc_insertion_point(field_get:Param.bit_width) + return _internal_bit_width(); +} +inline void Param::_internal_set_bit_width(::PROTOBUF_NAMESPACE_ID::int32 value) { + + bit_width_ = value; +} +inline void Param::set_bit_width(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_bit_width(value); + // @@protoc_insertion_point(field_set:Param.bit_width) +} + +// int32 int_width = 4; +inline void Param::clear_int_width() { + int_width_ = 0; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 Param::_internal_int_width() const { + return int_width_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 Param::int_width() const { + // @@protoc_insertion_point(field_get:Param.int_width) + return _internal_int_width(); +} +inline void Param::_internal_set_int_width(::PROTOBUF_NAMESPACE_ID::int32 value) { + + int_width_ = value; +} +inline void Param::set_int_width(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_int_width(value); + // @@protoc_insertion_point(field_set:Param.int_width) +} + +// int32 frac_width = 5; +inline void Param::clear_frac_width() { + frac_width_ = 0; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 Param::_internal_frac_width() const { + return frac_width_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 Param::frac_width() const { + // @@protoc_insertion_point(field_get:Param.frac_width) + return _internal_frac_width(); +} +inline void Param::_internal_set_frac_width(::PROTOBUF_NAMESPACE_ID::int32 value) { + + frac_width_ = value; +} +inline void Param::set_frac_width(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_frac_width(value); + // @@protoc_insertion_point(field_set:Param.frac_width) +} + +// float value = 6; +inline void Param::clear_value() { + value_ = 0; +} +inline float Param::_internal_value() const { + return value_; +} +inline float Param::value() const { + // @@protoc_insertion_point(field_get:Param.value) + return _internal_value(); +} +inline void Param::_internal_set_value(float value) { + + value_ = value; +} +inline void Param::set_value(float value) { + _internal_set_value(value); + // @@protoc_insertion_point(field_set:Param.value) +} + +// ------------------------------------------------------------------- + +// ObjectList + +// repeated .Param objects = 1; +inline int ObjectList::_internal_objects_size() const { + return objects_.size(); +} +inline int ObjectList::objects_size() const { + return _internal_objects_size(); +} +inline void ObjectList::clear_objects() { + objects_.Clear(); +} +inline ::Param* ObjectList::mutable_objects(int index) { + // @@protoc_insertion_point(field_mutable:ObjectList.objects) + return objects_.Mutable(index); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::Param >* +ObjectList::mutable_objects() { + // @@protoc_insertion_point(field_mutable_list:ObjectList.objects) + return &objects_; +} +inline const ::Param& ObjectList::_internal_objects(int index) const { + return objects_.Get(index); +} +inline const ::Param& ObjectList::objects(int index) const { + // @@protoc_insertion_point(field_get:ObjectList.objects) + return _internal_objects(index); +} +inline ::Param* ObjectList::_internal_add_objects() { + return objects_.Add(); +} +inline ::Param* ObjectList::add_objects() { + // @@protoc_insertion_point(field_add:ObjectList.objects) + return _internal_add_objects(); +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::Param >& +ObjectList::objects() const { + // @@protoc_insertion_point(field_list:ObjectList.objects) + return objects_; +} + +#ifdef __GNUC__ + #pragma GCC diagnostic pop +#endif // __GNUC__ +// ------------------------------------------------------------------- + + +// @@protoc_insertion_point(namespace_scope) + + +// @@protoc_insertion_point(global_scope) + +#include +#endif // GOOGLE_PROTOBUF_INCLUDED_GOOGLE_PROTOBUF_INCLUDED_ip_2eproto diff --git a/lib/Target/TaskFlow/IPInputs.proto b/lib/Target/TaskFlow/IPInputs.proto new file mode 100644 index 00000000..b2fc3a57 --- /dev/null +++ b/lib/Target/TaskFlow/IPInputs.proto @@ -0,0 +1,15 @@ +// protoc --cpp_out=. ip.proto +syntax = "proto3"; + +message Param { + string name = 1; + string data_type = 2; + int32 bit_width = 3; + int32 int_width = 4; + int32 frac_width = 5; + float value = 6; +} + +message ObjectList { + repeated Param objects = 1; +} \ No newline at end of file From 635aac959f05db6c3066b7c3767e3ae80ab2aed7 Mon Sep 17 00:00:00 2001 From: Hecmay Date: Tue, 29 Aug 2023 19:01:37 -0400 Subject: [PATCH 6/8] add license header --- lib/Target/TaskFlow/IPInputs.cc | 5 +++++ lib/Target/TaskFlow/IPInputs.h | 5 +++++ lib/Target/TaskFlow/IPInputs.proto | 5 +++++ 3 files changed, 15 insertions(+) diff --git a/lib/Target/TaskFlow/IPInputs.cc b/lib/Target/TaskFlow/IPInputs.cc index 52036711..f8270d1e 100644 --- a/lib/Target/TaskFlow/IPInputs.cc +++ b/lib/Target/TaskFlow/IPInputs.cc @@ -1,3 +1,8 @@ +/* + * Copyright HeteroCL authors. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ + // Generated by the protocol buffer compiler. DO NOT EDIT! // source: ip.proto diff --git a/lib/Target/TaskFlow/IPInputs.h b/lib/Target/TaskFlow/IPInputs.h index fcc6ccc5..d7c50673 100644 --- a/lib/Target/TaskFlow/IPInputs.h +++ b/lib/Target/TaskFlow/IPInputs.h @@ -1,3 +1,8 @@ +/* + * Copyright HeteroCL authors. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ + // Generated by the protocol buffer compiler. DO NOT EDIT! // source: ip.proto diff --git a/lib/Target/TaskFlow/IPInputs.proto b/lib/Target/TaskFlow/IPInputs.proto index b2fc3a57..2c7ba640 100644 --- a/lib/Target/TaskFlow/IPInputs.proto +++ b/lib/Target/TaskFlow/IPInputs.proto @@ -1,3 +1,8 @@ +/* + * Copyright HeteroCL authors. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ + // protoc --cpp_out=. ip.proto syntax = "proto3"; From 2107e563551dde95318060dd78685574c1875021 Mon Sep 17 00:00:00 2001 From: Hecmay Date: Tue, 29 Aug 2023 20:43:55 -0400 Subject: [PATCH 7/8] rename ip protobuf --- CMakeLists.txt | 10 +++++++++- .../hcl/Target/TaskFlow/IpArguments.pb.h | 0 lib/Target/TaskFlow/{IPInputs.cc => IpArguments.cc} | 4 +--- .../TaskFlow/{IPInputs.proto => IpArguments.proto} | 0 4 files changed, 10 insertions(+), 4 deletions(-) rename lib/Target/TaskFlow/IPInputs.h => include/hcl/Target/TaskFlow/IpArguments.pb.h (100%) rename lib/Target/TaskFlow/{IPInputs.cc => IpArguments.cc} (99%) rename lib/Target/TaskFlow/{IPInputs.proto => IpArguments.proto} (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 93b4124e..3cb8acbb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,6 +38,15 @@ if(OPENSCOP) include_directories("${OSL_INCLUDE_DIR}") endif() +if(TASKFLOW) + message(STATUS "Building Taskflow") + find_package(protobuf REQUIRED) + include_directories(${PROTOBUF_INCLUDE_DIRS}) + + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -lprotobuf") + include_directories(${PROJECT_SOURCE_DIR}/externals/taskflow) +endif() + list(APPEND CMAKE_MODULE_PATH "${MLIR_CMAKE_DIR}") list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_DIR}") include(TableGen) @@ -45,7 +54,6 @@ include(AddLLVM) include(AddMLIR) include(HandleLLVMOptions) -include_directories(${PROJECT_SOURCE_DIR}/externals/taskflow) include_directories(${LLVM_INCLUDE_DIRS}) include_directories(${MLIR_INCLUDE_DIRS}) include_directories(${PROJECT_SOURCE_DIR}/include) diff --git a/lib/Target/TaskFlow/IPInputs.h b/include/hcl/Target/TaskFlow/IpArguments.pb.h similarity index 100% rename from lib/Target/TaskFlow/IPInputs.h rename to include/hcl/Target/TaskFlow/IpArguments.pb.h diff --git a/lib/Target/TaskFlow/IPInputs.cc b/lib/Target/TaskFlow/IpArguments.cc similarity index 99% rename from lib/Target/TaskFlow/IPInputs.cc rename to lib/Target/TaskFlow/IpArguments.cc index f8270d1e..8c4b1135 100644 --- a/lib/Target/TaskFlow/IPInputs.cc +++ b/lib/Target/TaskFlow/IpArguments.cc @@ -5,9 +5,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: ip.proto - -#include "IPInputs.pb.h" - +#include "hcl/Target/TaskFlow/IpArguments.pb.h" #include #include diff --git a/lib/Target/TaskFlow/IPInputs.proto b/lib/Target/TaskFlow/IpArguments.proto similarity index 100% rename from lib/Target/TaskFlow/IPInputs.proto rename to lib/Target/TaskFlow/IpArguments.proto From b157f05c096ef7b9426eae993b13afbcb75a6bcb Mon Sep 17 00:00:00 2001 From: Hecmay Date: Tue, 29 Aug 2023 21:44:25 -0400 Subject: [PATCH 8/8] update protobuf spec --- include/hcl/Target/TaskFlow/IpArguments.pb.h | 430 ++++++++++++++++-- .../{IpArguments.cc => IpArguments.pb.cc} | 391 +++++++++++++--- lib/Target/TaskFlow/IpArguments.proto | 9 +- 3 files changed, 736 insertions(+), 94 deletions(-) rename lib/Target/TaskFlow/{IpArguments.cc => IpArguments.pb.cc} (63%) diff --git a/include/hcl/Target/TaskFlow/IpArguments.pb.h b/include/hcl/Target/TaskFlow/IpArguments.pb.h index d7c50673..51454c28 100644 --- a/include/hcl/Target/TaskFlow/IpArguments.pb.h +++ b/include/hcl/Target/TaskFlow/IpArguments.pb.h @@ -4,10 +4,10 @@ */ // Generated by the protocol buffer compiler. DO NOT EDIT! -// source: ip.proto +// source: IpArguments.proto -#ifndef GOOGLE_PROTOBUF_INCLUDED_ip_2eproto -#define GOOGLE_PROTOBUF_INCLUDED_ip_2eproto +#ifndef GOOGLE_PROTOBUF_INCLUDED_IpArguments_2eproto +#define GOOGLE_PROTOBUF_INCLUDED_IpArguments_2eproto #include #include @@ -38,7 +38,7 @@ #include // @@protoc_insertion_point(includes) #include -#define PROTOBUF_INTERNAL_EXPORT_ip_2eproto +#define PROTOBUF_INTERNAL_EXPORT_IpArguments_2eproto PROTOBUF_NAMESPACE_OPEN namespace internal { class AnyMetadata; @@ -46,32 +46,212 @@ class AnyMetadata; PROTOBUF_NAMESPACE_CLOSE // Internal implementation detail -- do not use these members. -struct TableStruct_ip_2eproto { +struct TableStruct_IpArguments_2eproto { static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTableField entries[] PROTOBUF_SECTION_VARIABLE(protodesc_cold); static const ::PROTOBUF_NAMESPACE_ID::internal::AuxiliaryParseTableField aux[] PROTOBUF_SECTION_VARIABLE(protodesc_cold); - static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTable schema[2] + static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTable schema[3] PROTOBUF_SECTION_VARIABLE(protodesc_cold); static const ::PROTOBUF_NAMESPACE_ID::internal::FieldMetadata field_metadata[]; static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[]; static const ::PROTOBUF_NAMESPACE_ID::uint32 offsets[]; }; -extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_ip_2eproto; -::PROTOBUF_NAMESPACE_ID::Metadata descriptor_table_ip_2eproto_metadata_getter(int index); +extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_IpArguments_2eproto; +::PROTOBUF_NAMESPACE_ID::Metadata descriptor_table_IpArguments_2eproto_metadata_getter(int index); class ObjectList; struct ObjectListDefaultTypeInternal; extern ObjectListDefaultTypeInternal _ObjectList_default_instance_; class Param; struct ParamDefaultTypeInternal; extern ParamDefaultTypeInternal _Param_default_instance_; +class Tensor; +struct TensorDefaultTypeInternal; +extern TensorDefaultTypeInternal _Tensor_default_instance_; PROTOBUF_NAMESPACE_OPEN template<> ::ObjectList* Arena::CreateMaybeMessage<::ObjectList>(Arena*); template<> ::Param* Arena::CreateMaybeMessage<::Param>(Arena*); +template<> ::Tensor* Arena::CreateMaybeMessage<::Tensor>(Arena*); PROTOBUF_NAMESPACE_CLOSE // =================================================================== +class Tensor PROTOBUF_FINAL : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:Tensor) */ { + public: + inline Tensor() : Tensor(nullptr) {} + virtual ~Tensor(); + explicit constexpr Tensor(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + Tensor(const Tensor& from); + Tensor(Tensor&& from) noexcept + : Tensor() { + *this = ::std::move(from); + } + + inline Tensor& operator=(const Tensor& from) { + CopyFrom(from); + return *this; + } + inline Tensor& operator=(Tensor&& from) noexcept { + if (GetArena() == from.GetArena()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return GetMetadataStatic().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return GetMetadataStatic().reflection; + } + static const Tensor& default_instance() { + return *internal_default_instance(); + } + static inline const Tensor* internal_default_instance() { + return reinterpret_cast( + &_Tensor_default_instance_); + } + static constexpr int kIndexInFileMessages = + 0; + + friend void swap(Tensor& a, Tensor& b) { + a.Swap(&b); + } + inline void Swap(Tensor* other) { + if (other == this) return; + if (GetArena() == other->GetArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(Tensor* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline Tensor* New() const final { + return CreateMaybeMessage(nullptr); + } + + Tensor* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void CopyFrom(const Tensor& from); + void MergeFrom(const Tensor& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + inline void SharedCtor(); + inline void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(Tensor* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "Tensor"; + } + protected: + explicit Tensor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + private: + static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { + return ::descriptor_table_IpArguments_2eproto_metadata_getter(kIndexInFileMessages); + } + + public: + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kDimensionsFieldNumber = 1, + kValuesFieldNumber = 2, + }; + // repeated int32 dimensions = 1; + int dimensions_size() const; + private: + int _internal_dimensions_size() const; + public: + void clear_dimensions(); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_dimensions(int index) const; + const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >& + _internal_dimensions() const; + void _internal_add_dimensions(::PROTOBUF_NAMESPACE_ID::int32 value); + ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >* + _internal_mutable_dimensions(); + public: + ::PROTOBUF_NAMESPACE_ID::int32 dimensions(int index) const; + void set_dimensions(int index, ::PROTOBUF_NAMESPACE_ID::int32 value); + void add_dimensions(::PROTOBUF_NAMESPACE_ID::int32 value); + const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >& + dimensions() const; + ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >* + mutable_dimensions(); + + // repeated float values = 2; + int values_size() const; + private: + int _internal_values_size() const; + public: + void clear_values(); + private: + float _internal_values(int index) const; + const ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >& + _internal_values() const; + void _internal_add_values(float value); + ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >* + _internal_mutable_values(); + public: + float values(int index) const; + void set_values(int index, float value); + void add_values(float value); + const ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >& + values() const; + ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >* + mutable_values(); + + // @@protoc_insertion_point(class_scope:Tensor) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 > dimensions_; + mutable std::atomic _dimensions_cached_byte_size_; + ::PROTOBUF_NAMESPACE_ID::RepeatedField< float > values_; + mutable std::atomic _values_cached_byte_size_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_IpArguments_2eproto; +}; +// ------------------------------------------------------------------- + class Param PROTOBUF_FINAL : public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:Param) */ { public: @@ -115,7 +295,7 @@ class Param PROTOBUF_FINAL : &_Param_default_instance_); } static constexpr int kIndexInFileMessages = - 0; + 1; friend void swap(Param& a, Param& b) { a.Swap(&b); @@ -175,7 +355,7 @@ class Param PROTOBUF_FINAL : ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; private: static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { - return ::descriptor_table_ip_2eproto_metadata_getter(kIndexInFileMessages); + return ::descriptor_table_IpArguments_2eproto_metadata_getter(kIndexInFileMessages); } public: @@ -187,10 +367,10 @@ class Param PROTOBUF_FINAL : enum : int { kNameFieldNumber = 1, kDataTypeFieldNumber = 2, + kTensorFieldNumber = 6, kBitWidthFieldNumber = 3, kIntWidthFieldNumber = 4, kFracWidthFieldNumber = 5, - kValueFieldNumber = 6, }; // string name = 1; void clear_name(); @@ -224,6 +404,24 @@ class Param PROTOBUF_FINAL : std::string* _internal_mutable_data_type(); public: + // .Tensor tensor = 6; + bool has_tensor() const; + private: + bool _internal_has_tensor() const; + public: + void clear_tensor(); + const ::Tensor& tensor() const; + ::Tensor* release_tensor(); + ::Tensor* mutable_tensor(); + void set_allocated_tensor(::Tensor* tensor); + private: + const ::Tensor& _internal_tensor() const; + ::Tensor* _internal_mutable_tensor(); + public: + void unsafe_arena_set_allocated_tensor( + ::Tensor* tensor); + ::Tensor* unsafe_arena_release_tensor(); + // int32 bit_width = 3; void clear_bit_width(); ::PROTOBUF_NAMESPACE_ID::int32 bit_width() const; @@ -251,15 +449,6 @@ class Param PROTOBUF_FINAL : void _internal_set_frac_width(::PROTOBUF_NAMESPACE_ID::int32 value); public: - // float value = 6; - void clear_value(); - float value() const; - void set_value(float value); - private: - float _internal_value() const; - void _internal_set_value(float value); - public: - // @@protoc_insertion_point(class_scope:Param) private: class _Internal; @@ -269,12 +458,12 @@ class Param PROTOBUF_FINAL : typedef void DestructorSkippable_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr name_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr data_type_; + ::Tensor* tensor_; ::PROTOBUF_NAMESPACE_ID::int32 bit_width_; ::PROTOBUF_NAMESPACE_ID::int32 int_width_; ::PROTOBUF_NAMESPACE_ID::int32 frac_width_; - float value_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; - friend struct ::TableStruct_ip_2eproto; + friend struct ::TableStruct_IpArguments_2eproto; }; // ------------------------------------------------------------------- @@ -321,7 +510,7 @@ class ObjectList PROTOBUF_FINAL : &_ObjectList_default_instance_); } static constexpr int kIndexInFileMessages = - 1; + 2; friend void swap(ObjectList& a, ObjectList& b) { a.Swap(&b); @@ -381,7 +570,7 @@ class ObjectList PROTOBUF_FINAL : ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; private: static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { - return ::descriptor_table_ip_2eproto_metadata_getter(kIndexInFileMessages); + return ::descriptor_table_IpArguments_2eproto_metadata_getter(kIndexInFileMessages); } public: @@ -420,7 +609,7 @@ class ObjectList PROTOBUF_FINAL : typedef void DestructorSkippable_; ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::Param > objects_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; - friend struct ::TableStruct_ip_2eproto; + friend struct ::TableStruct_IpArguments_2eproto; }; // =================================================================== @@ -431,6 +620,104 @@ class ObjectList PROTOBUF_FINAL : #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wstrict-aliasing" #endif // __GNUC__ +// Tensor + +// repeated int32 dimensions = 1; +inline int Tensor::_internal_dimensions_size() const { + return dimensions_.size(); +} +inline int Tensor::dimensions_size() const { + return _internal_dimensions_size(); +} +inline void Tensor::clear_dimensions() { + dimensions_.Clear(); +} +inline ::PROTOBUF_NAMESPACE_ID::int32 Tensor::_internal_dimensions(int index) const { + return dimensions_.Get(index); +} +inline ::PROTOBUF_NAMESPACE_ID::int32 Tensor::dimensions(int index) const { + // @@protoc_insertion_point(field_get:Tensor.dimensions) + return _internal_dimensions(index); +} +inline void Tensor::set_dimensions(int index, ::PROTOBUF_NAMESPACE_ID::int32 value) { + dimensions_.Set(index, value); + // @@protoc_insertion_point(field_set:Tensor.dimensions) +} +inline void Tensor::_internal_add_dimensions(::PROTOBUF_NAMESPACE_ID::int32 value) { + dimensions_.Add(value); +} +inline void Tensor::add_dimensions(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_add_dimensions(value); + // @@protoc_insertion_point(field_add:Tensor.dimensions) +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >& +Tensor::_internal_dimensions() const { + return dimensions_; +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >& +Tensor::dimensions() const { + // @@protoc_insertion_point(field_list:Tensor.dimensions) + return _internal_dimensions(); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >* +Tensor::_internal_mutable_dimensions() { + return &dimensions_; +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >* +Tensor::mutable_dimensions() { + // @@protoc_insertion_point(field_mutable_list:Tensor.dimensions) + return _internal_mutable_dimensions(); +} + +// repeated float values = 2; +inline int Tensor::_internal_values_size() const { + return values_.size(); +} +inline int Tensor::values_size() const { + return _internal_values_size(); +} +inline void Tensor::clear_values() { + values_.Clear(); +} +inline float Tensor::_internal_values(int index) const { + return values_.Get(index); +} +inline float Tensor::values(int index) const { + // @@protoc_insertion_point(field_get:Tensor.values) + return _internal_values(index); +} +inline void Tensor::set_values(int index, float value) { + values_.Set(index, value); + // @@protoc_insertion_point(field_set:Tensor.values) +} +inline void Tensor::_internal_add_values(float value) { + values_.Add(value); +} +inline void Tensor::add_values(float value) { + _internal_add_values(value); + // @@protoc_insertion_point(field_add:Tensor.values) +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >& +Tensor::_internal_values() const { + return values_; +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >& +Tensor::values() const { + // @@protoc_insertion_point(field_list:Tensor.values) + return _internal_values(); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >* +Tensor::_internal_mutable_values() { + return &values_; +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >* +Tensor::mutable_values() { + // @@protoc_insertion_point(field_mutable_list:Tensor.values) + return _internal_mutable_values(); +} + +// ------------------------------------------------------------------- + // Param // string name = 1; @@ -615,24 +902,87 @@ inline void Param::set_frac_width(::PROTOBUF_NAMESPACE_ID::int32 value) { // @@protoc_insertion_point(field_set:Param.frac_width) } -// float value = 6; -inline void Param::clear_value() { - value_ = 0; +// .Tensor tensor = 6; +inline bool Param::_internal_has_tensor() const { + return this != internal_default_instance() && tensor_ != nullptr; +} +inline bool Param::has_tensor() const { + return _internal_has_tensor(); +} +inline void Param::clear_tensor() { + if (GetArena() == nullptr && tensor_ != nullptr) { + delete tensor_; + } + tensor_ = nullptr; } -inline float Param::_internal_value() const { - return value_; +inline const ::Tensor& Param::_internal_tensor() const { + const ::Tensor* p = tensor_; + return p != nullptr ? *p : reinterpret_cast( + ::_Tensor_default_instance_); } -inline float Param::value() const { - // @@protoc_insertion_point(field_get:Param.value) - return _internal_value(); +inline const ::Tensor& Param::tensor() const { + // @@protoc_insertion_point(field_get:Param.tensor) + return _internal_tensor(); } -inline void Param::_internal_set_value(float value) { +inline void Param::unsafe_arena_set_allocated_tensor( + ::Tensor* tensor) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(tensor_); + } + tensor_ = tensor; + if (tensor) { + + } else { + + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:Param.tensor) +} +inline ::Tensor* Param::release_tensor() { - value_ = value; + ::Tensor* temp = tensor_; + tensor_ = nullptr; + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::Tensor* Param::unsafe_arena_release_tensor() { + // @@protoc_insertion_point(field_release:Param.tensor) + + ::Tensor* temp = tensor_; + tensor_ = nullptr; + return temp; } -inline void Param::set_value(float value) { - _internal_set_value(value); - // @@protoc_insertion_point(field_set:Param.value) +inline ::Tensor* Param::_internal_mutable_tensor() { + + if (tensor_ == nullptr) { + auto* p = CreateMaybeMessage<::Tensor>(GetArena()); + tensor_ = p; + } + return tensor_; +} +inline ::Tensor* Param::mutable_tensor() { + // @@protoc_insertion_point(field_mutable:Param.tensor) + return _internal_mutable_tensor(); +} +inline void Param::set_allocated_tensor(::Tensor* tensor) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete tensor_; + } + if (tensor) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(tensor); + if (message_arena != submessage_arena) { + tensor = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, tensor, submessage_arena); + } + + } else { + + } + tensor_ = tensor; + // @@protoc_insertion_point(field_set_allocated:Param.tensor) } // ------------------------------------------------------------------- @@ -683,6 +1033,8 @@ ObjectList::objects() const { #endif // __GNUC__ // ------------------------------------------------------------------- +// ------------------------------------------------------------------- + // @@protoc_insertion_point(namespace_scope) @@ -690,4 +1042,4 @@ ObjectList::objects() const { // @@protoc_insertion_point(global_scope) #include -#endif // GOOGLE_PROTOBUF_INCLUDED_GOOGLE_PROTOBUF_INCLUDED_ip_2eproto +#endif // GOOGLE_PROTOBUF_INCLUDED_GOOGLE_PROTOBUF_INCLUDED_IpArguments_2eproto diff --git a/lib/Target/TaskFlow/IpArguments.cc b/lib/Target/TaskFlow/IpArguments.pb.cc similarity index 63% rename from lib/Target/TaskFlow/IpArguments.cc rename to lib/Target/TaskFlow/IpArguments.pb.cc index 8c4b1135..ebb4c911 100644 --- a/lib/Target/TaskFlow/IpArguments.cc +++ b/lib/Target/TaskFlow/IpArguments.pb.cc @@ -4,8 +4,10 @@ */ // Generated by the protocol buffer compiler. DO NOT EDIT! -// source: ip.proto +// source: IpArguments.proto + #include "hcl/Target/TaskFlow/IpArguments.pb.h" + #include #include @@ -19,14 +21,29 @@ #include PROTOBUF_PRAGMA_INIT_SEG +constexpr Tensor::Tensor( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : dimensions_() + , _dimensions_cached_byte_size_() + , values_() + , _values_cached_byte_size_(){} +struct TensorDefaultTypeInternal { + constexpr TensorDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~TensorDefaultTypeInternal() {} + union { + Tensor _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT TensorDefaultTypeInternal _Tensor_default_instance_; constexpr Param::Param( ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) : name_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) , data_type_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , tensor_(nullptr) , bit_width_(0) , int_width_(0) - , frac_width_(0) - , value_(0){} + , frac_width_(0){} struct ParamDefaultTypeInternal { constexpr ParamDefaultTypeInternal() : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} @@ -48,11 +65,18 @@ struct ObjectListDefaultTypeInternal { }; }; PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT ObjectListDefaultTypeInternal _ObjectList_default_instance_; -static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_ip_2eproto[2]; -static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_ip_2eproto = nullptr; -static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_ip_2eproto = nullptr; +static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_IpArguments_2eproto[3]; +static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_IpArguments_2eproto = nullptr; +static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_IpArguments_2eproto = nullptr; -const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_ip_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { +const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_IpArguments_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { + ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::Tensor, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + PROTOBUF_FIELD_OFFSET(::Tensor, dimensions_), + PROTOBUF_FIELD_OFFSET(::Tensor, values_), ~0u, // no _has_bits_ PROTOBUF_FIELD_OFFSET(::Param, _internal_metadata_), ~0u, // no _extensions_ @@ -63,7 +87,7 @@ const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_ip_2eproto::offsets[] PROTOBUF PROTOBUF_FIELD_OFFSET(::Param, bit_width_), PROTOBUF_FIELD_OFFSET(::Param, int_width_), PROTOBUF_FIELD_OFFSET(::Param, frac_width_), - PROTOBUF_FIELD_OFFSET(::Param, value_), + PROTOBUF_FIELD_OFFSET(::Param, tensor_), ~0u, // no _has_bits_ PROTOBUF_FIELD_OFFSET(::ObjectList, _internal_metadata_), ~0u, // no _extensions_ @@ -72,44 +96,288 @@ const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_ip_2eproto::offsets[] PROTOBUF PROTOBUF_FIELD_OFFSET(::ObjectList, objects_), }; static const ::PROTOBUF_NAMESPACE_ID::internal::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { - { 0, -1, sizeof(::Param)}, - { 11, -1, sizeof(::ObjectList)}, + { 0, -1, sizeof(::Tensor)}, + { 7, -1, sizeof(::Param)}, + { 18, -1, sizeof(::ObjectList)}, }; static ::PROTOBUF_NAMESPACE_ID::Message const * const file_default_instances[] = { + reinterpret_cast(&::_Tensor_default_instance_), reinterpret_cast(&::_Param_default_instance_), reinterpret_cast(&::_ObjectList_default_instance_), }; -const char descriptor_table_protodef_ip_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = - "\n\010ip.proto\"q\n\005Param\022\014\n\004name\030\001 \001(\t\022\021\n\tdat" - "a_type\030\002 \001(\t\022\021\n\tbit_width\030\003 \001(\005\022\021\n\tint_w" - "idth\030\004 \001(\005\022\022\n\nfrac_width\030\005 \001(\005\022\r\n\005value\030" - "\006 \001(\002\"%\n\nObjectList\022\027\n\007objects\030\001 \003(\0132\006.P" - "aramb\006proto3" +const char descriptor_table_protodef_IpArguments_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = + "\n\021IpArguments.proto\",\n\006Tensor\022\022\n\ndimensi" + "ons\030\001 \003(\005\022\016\n\006values\030\002 \003(\002\"{\n\005Param\022\014\n\004na" + "me\030\001 \001(\t\022\021\n\tdata_type\030\002 \001(\t\022\021\n\tbit_width" + "\030\003 \001(\005\022\021\n\tint_width\030\004 \001(\005\022\022\n\nfrac_width\030" + "\005 \001(\005\022\027\n\006tensor\030\006 \001(\0132\007.Tensor\"%\n\nObject" + "List\022\027\n\007objects\030\001 \003(\0132\006.Paramb\006proto3" ; -static ::PROTOBUF_NAMESPACE_ID::internal::once_flag descriptor_table_ip_2eproto_once; -const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_ip_2eproto = { - false, false, 172, descriptor_table_protodef_ip_2eproto, "ip.proto", - &descriptor_table_ip_2eproto_once, nullptr, 0, 2, - schemas, file_default_instances, TableStruct_ip_2eproto::offsets, - file_level_metadata_ip_2eproto, file_level_enum_descriptors_ip_2eproto, file_level_service_descriptors_ip_2eproto, +static ::PROTOBUF_NAMESPACE_ID::internal::once_flag descriptor_table_IpArguments_2eproto_once; +const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_IpArguments_2eproto = { + false, false, 237, descriptor_table_protodef_IpArguments_2eproto, "IpArguments.proto", + &descriptor_table_IpArguments_2eproto_once, nullptr, 0, 3, + schemas, file_default_instances, TableStruct_IpArguments_2eproto::offsets, + file_level_metadata_IpArguments_2eproto, file_level_enum_descriptors_IpArguments_2eproto, file_level_service_descriptors_IpArguments_2eproto, }; PROTOBUF_ATTRIBUTE_WEAK ::PROTOBUF_NAMESPACE_ID::Metadata -descriptor_table_ip_2eproto_metadata_getter(int index) { - ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&descriptor_table_ip_2eproto); - return descriptor_table_ip_2eproto.file_level_metadata[index]; +descriptor_table_IpArguments_2eproto_metadata_getter(int index) { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&descriptor_table_IpArguments_2eproto); + return descriptor_table_IpArguments_2eproto.file_level_metadata[index]; } // Force running AddDescriptors() at dynamic initialization time. -PROTOBUF_ATTRIBUTE_INIT_PRIORITY static ::PROTOBUF_NAMESPACE_ID::internal::AddDescriptorsRunner dynamic_init_dummy_ip_2eproto(&descriptor_table_ip_2eproto); +PROTOBUF_ATTRIBUTE_INIT_PRIORITY static ::PROTOBUF_NAMESPACE_ID::internal::AddDescriptorsRunner dynamic_init_dummy_IpArguments_2eproto(&descriptor_table_IpArguments_2eproto); + +// =================================================================== + +class Tensor::_Internal { + public: +}; + +Tensor::Tensor(::PROTOBUF_NAMESPACE_ID::Arena* arena) + : ::PROTOBUF_NAMESPACE_ID::Message(arena), + dimensions_(arena), + values_(arena) { + SharedCtor(); + RegisterArenaDtor(arena); + // @@protoc_insertion_point(arena_constructor:Tensor) +} +Tensor::Tensor(const Tensor& from) + : ::PROTOBUF_NAMESPACE_ID::Message(), + dimensions_(from.dimensions_), + values_(from.values_) { + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + // @@protoc_insertion_point(copy_constructor:Tensor) +} + +void Tensor::SharedCtor() { +} + +Tensor::~Tensor() { + // @@protoc_insertion_point(destructor:Tensor) + SharedDtor(); + _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +void Tensor::SharedDtor() { + GOOGLE_DCHECK(GetArena() == nullptr); +} + +void Tensor::ArenaDtor(void* object) { + Tensor* _this = reinterpret_cast< Tensor* >(object); + (void)_this; +} +void Tensor::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void Tensor::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void Tensor::Clear() { +// @@protoc_insertion_point(message_clear_start:Tensor) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + dimensions_.Clear(); + values_.Clear(); + _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +const char* Tensor::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + ::PROTOBUF_NAMESPACE_ID::uint32 tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + CHK_(ptr); + switch (tag >> 3) { + // repeated int32 dimensions = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { + ptr = ::PROTOBUF_NAMESPACE_ID::internal::PackedInt32Parser(_internal_mutable_dimensions(), ptr, ctx); + CHK_(ptr); + } else if (static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8) { + _internal_add_dimensions(::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr)); + CHK_(ptr); + } else goto handle_unusual; + continue; + // repeated float values = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) { + ptr = ::PROTOBUF_NAMESPACE_ID::internal::PackedFloatParser(_internal_mutable_values(), ptr, ctx); + CHK_(ptr); + } else if (static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 21) { + _internal_add_values(::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad(ptr)); + ptr += sizeof(float); + } else goto handle_unusual; + continue; + default: { + handle_unusual: + if ((tag & 7) == 4 || tag == 0) { + ctx->SetLastTag(tag); + goto success; + } + ptr = UnknownFieldParse(tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); + continue; + } + } // switch + } // while +success: + return ptr; +failure: + ptr = nullptr; + goto success; +#undef CHK_ +} + +::PROTOBUF_NAMESPACE_ID::uint8* Tensor::_InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:Tensor) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + // repeated int32 dimensions = 1; + { + int byte_size = _dimensions_cached_byte_size_.load(std::memory_order_relaxed); + if (byte_size > 0) { + target = stream->WriteInt32Packed( + 1, _internal_dimensions(), byte_size, target); + } + } + + // repeated float values = 2; + if (this->_internal_values_size() > 0) { + target = stream->WriteFixedPacked(2, _internal_values(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:Tensor) + return target; +} + +size_t Tensor::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:Tensor) + size_t total_size = 0; + + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // repeated int32 dimensions = 1; + { + size_t data_size = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + Int32Size(this->dimensions_); + if (data_size > 0) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size( + static_cast<::PROTOBUF_NAMESPACE_ID::int32>(data_size)); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(data_size); + _dimensions_cached_byte_size_.store(cached_size, + std::memory_order_relaxed); + total_size += data_size; + } + + // repeated float values = 2; + { + unsigned int count = static_cast(this->_internal_values_size()); + size_t data_size = 4UL * count; + if (data_size > 0) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size( + static_cast<::PROTOBUF_NAMESPACE_ID::int32>(data_size)); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(data_size); + _values_cached_byte_size_.store(cached_size, + std::memory_order_relaxed); + total_size += data_size; + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( + _internal_metadata_, total_size, &_cached_size_); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void Tensor::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { +// @@protoc_insertion_point(generalized_merge_from_start:Tensor) + GOOGLE_DCHECK_NE(&from, this); + const Tensor* source = + ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated( + &from); + if (source == nullptr) { + // @@protoc_insertion_point(generalized_merge_from_cast_fail:Tensor) + ::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this); + } else { + // @@protoc_insertion_point(generalized_merge_from_cast_success:Tensor) + MergeFrom(*source); + } +} + +void Tensor::MergeFrom(const Tensor& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:Tensor) + GOOGLE_DCHECK_NE(&from, this); + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + dimensions_.MergeFrom(from.dimensions_); + values_.MergeFrom(from.values_); +} + +void Tensor::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { +// @@protoc_insertion_point(generalized_copy_from_start:Tensor) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void Tensor::CopyFrom(const Tensor& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:Tensor) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool Tensor::IsInitialized() const { + return true; +} + +void Tensor::InternalSwap(Tensor* other) { + using std::swap; + _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_); + dimensions_.InternalSwap(&other->dimensions_); + values_.InternalSwap(&other->values_); +} + +::PROTOBUF_NAMESPACE_ID::Metadata Tensor::GetMetadata() const { + return GetMetadataStatic(); +} + // =================================================================== class Param::_Internal { public: + static const ::Tensor& tensor(const Param* msg); }; +const ::Tensor& +Param::_Internal::tensor(const Param* msg) { + return *msg->tensor_; +} Param::Param(::PROTOBUF_NAMESPACE_ID::Arena* arena) : ::PROTOBUF_NAMESPACE_ID::Message(arena) { SharedCtor(); @@ -129,9 +397,14 @@ Param::Param(const Param& from) data_type_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_data_type(), GetArena()); } + if (from._internal_has_tensor()) { + tensor_ = new ::Tensor(*from.tensor_); + } else { + tensor_ = nullptr; + } ::memcpy(&bit_width_, &from.bit_width_, - static_cast(reinterpret_cast(&value_) - - reinterpret_cast(&bit_width_)) + sizeof(value_)); + static_cast(reinterpret_cast(&frac_width_) - + reinterpret_cast(&bit_width_)) + sizeof(frac_width_)); // @@protoc_insertion_point(copy_constructor:Param) } @@ -139,9 +412,9 @@ void Param::SharedCtor() { name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); data_type_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); ::memset(reinterpret_cast(this) + static_cast( - reinterpret_cast(&bit_width_) - reinterpret_cast(this)), - 0, static_cast(reinterpret_cast(&value_) - - reinterpret_cast(&bit_width_)) + sizeof(value_)); + reinterpret_cast(&tensor_) - reinterpret_cast(this)), + 0, static_cast(reinterpret_cast(&frac_width_) - + reinterpret_cast(&tensor_)) + sizeof(frac_width_)); } Param::~Param() { @@ -154,6 +427,7 @@ void Param::SharedDtor() { GOOGLE_DCHECK(GetArena() == nullptr); name_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); data_type_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + if (this != internal_default_instance()) delete tensor_; } void Param::ArenaDtor(void* object) { @@ -174,9 +448,13 @@ void Param::Clear() { name_.ClearToEmpty(); data_type_.ClearToEmpty(); + if (GetArena() == nullptr && tensor_ != nullptr) { + delete tensor_; + } + tensor_ = nullptr; ::memset(&bit_width_, 0, static_cast( - reinterpret_cast(&value_) - - reinterpret_cast(&bit_width_)) + sizeof(value_)); + reinterpret_cast(&frac_width_) - + reinterpret_cast(&bit_width_)) + sizeof(frac_width_)); _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); } @@ -226,11 +504,11 @@ const char* Param::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inte CHK_(ptr); } else goto handle_unusual; continue; - // float value = 6; + // .Tensor tensor = 6; case 6: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 53)) { - value_ = ::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad(ptr); - ptr += sizeof(float); + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 50)) { + ptr = ctx->ParseMessage(_internal_mutable_tensor(), ptr); + CHK_(ptr); } else goto handle_unusual; continue; default: { @@ -299,10 +577,12 @@ ::PROTOBUF_NAMESPACE_ID::uint8* Param::_InternalSerialize( target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(5, this->_internal_frac_width(), target); } - // float value = 6; - if (!(this->value() <= 0 && this->value() >= 0)) { + // .Tensor tensor = 6; + if (this->has_tensor()) { target = stream->EnsureSpace(target); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteFloatToArray(6, this->_internal_value(), target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 6, _Internal::tensor(this), target, stream); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { @@ -335,6 +615,13 @@ size_t Param::ByteSizeLong() const { this->_internal_data_type()); } + // .Tensor tensor = 6; + if (this->has_tensor()) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *tensor_); + } + // int32 bit_width = 3; if (this->bit_width() != 0) { total_size += 1 + @@ -356,11 +643,6 @@ size_t Param::ByteSizeLong() const { this->_internal_frac_width()); } - // float value = 6; - if (!(this->value() <= 0 && this->value() >= 0)) { - total_size += 1 + 4; - } - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( _internal_metadata_, total_size, &_cached_size_); @@ -398,6 +680,9 @@ void Param::MergeFrom(const Param& from) { if (from.data_type().size() > 0) { _internal_set_data_type(from._internal_data_type()); } + if (from.has_tensor()) { + _internal_mutable_tensor()->::Tensor::MergeFrom(from._internal_tensor()); + } if (from.bit_width() != 0) { _internal_set_bit_width(from._internal_bit_width()); } @@ -407,9 +692,6 @@ void Param::MergeFrom(const Param& from) { if (from.frac_width() != 0) { _internal_set_frac_width(from._internal_frac_width()); } - if (!(from.value() <= 0 && from.value() >= 0)) { - _internal_set_value(from._internal_value()); - } } void Param::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { @@ -436,11 +718,11 @@ void Param::InternalSwap(Param* other) { name_.Swap(&other->name_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); data_type_.Swap(&other->data_type_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); ::PROTOBUF_NAMESPACE_ID::internal::memswap< - PROTOBUF_FIELD_OFFSET(Param, value_) - + sizeof(Param::value_) - - PROTOBUF_FIELD_OFFSET(Param, bit_width_)>( - reinterpret_cast(&bit_width_), - reinterpret_cast(&other->bit_width_)); + PROTOBUF_FIELD_OFFSET(Param, frac_width_) + + sizeof(Param::frac_width_) + - PROTOBUF_FIELD_OFFSET(Param, tensor_)>( + reinterpret_cast(&tensor_), + reinterpret_cast(&other->tensor_)); } ::PROTOBUF_NAMESPACE_ID::Metadata Param::GetMetadata() const { @@ -644,6 +926,9 @@ ::PROTOBUF_NAMESPACE_ID::Metadata ObjectList::GetMetadata() const { // @@protoc_insertion_point(namespace_scope) PROTOBUF_NAMESPACE_OPEN +template<> PROTOBUF_NOINLINE ::Tensor* Arena::CreateMaybeMessage< ::Tensor >(Arena* arena) { + return Arena::CreateMessageInternal< ::Tensor >(arena); +} template<> PROTOBUF_NOINLINE ::Param* Arena::CreateMaybeMessage< ::Param >(Arena* arena) { return Arena::CreateMessageInternal< ::Param >(arena); } diff --git a/lib/Target/TaskFlow/IpArguments.proto b/lib/Target/TaskFlow/IpArguments.proto index 2c7ba640..32a9f2ff 100644 --- a/lib/Target/TaskFlow/IpArguments.proto +++ b/lib/Target/TaskFlow/IpArguments.proto @@ -3,16 +3,21 @@ * SPDX-License-Identifier: Apache-2.0 */ -// protoc --cpp_out=. ip.proto +// protoc --cpp_out=. IpArguments.proto syntax = "proto3"; +message Tensor { + repeated int32 dimensions = 1; + repeated float values = 2; +} + message Param { string name = 1; string data_type = 2; int32 bit_width = 3; int32 int_width = 4; int32 frac_width = 5; - float value = 6; + Tensor tensor = 6; } message ObjectList {